Skip to content

Commit

Permalink
CI: add continuous (PREVIEW) releases (#16)
Browse files Browse the repository at this point in the history
* CI: add continuous (PREVIEW) releases

* add: debug job

* add: more debug

* update: `if` condition of workflow Job

* fix: Label removal for workflows

* update: remove debugging job, Fix removal of label, Add `synchronize` event for workflows

* fix: labels env inputted as separate args in `run` command of workflows

* fix: update installation step for pkg-pr-new

* update: parse the labels as string in remove label workflow step

* fix: `To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable`

* add: workflows perms

* add: list files to workflow for debugging

- Finding the causes why `yarn` is detected as pkg Manager instead of `npm`

* add: paths to include & exclude, Add trigger for push event for Workflows

* fix: github event name condition for workflows
  • Loading branch information
UnschooledGamer authored Oct 22, 2024
1 parent 7fbd1de commit c2f70bc
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/continuous-Preview-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: continuous (Preview) releases
# avoids paths like tests folder, .md, and anything that starts with `.`
# also avoids tags.
on:
workflow_dispatch:
pull_request_review:
types: [submitted]
pull_request:
types: [labeled, synchronize]
paths:
- 'build/**'
- '!tests/**'
- '!*.md'
- '!.*'
push:
paths:
- 'build/**'
- '!tests/**'
- '!*.md'
- '!.*'
branches: [main]
tags:
- "!**"

permissions:
pull-requests: write


jobs:
approved:
if: github.event.review.state == 'APPROVED' && !contains(github.event.pull_request.labels.*.name, 'DO NOT PREVIEW RELEASE') || contains(github.event.pull_request.labels.*.name, 'Bypass check - PREVIEW RELEASE') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'PR Manual CI RUN'))
|| contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Install pkg-pr-new & prebuild, dependencies
run: npm install pkg-pr-new --save-dev --no-frozen-lockfile

- run: ls -la

- run: npx pkg-pr-new publish

- name: Remove Manual PR Run label
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'PR Manual CI RUN')
run: gh pr edit $PR --remove-label "$labels"
env:
PR: ${{ github.event.pull_request.number }}
labels: 'PR Manual CI RUN'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c2f70bc

Please sign in to comment.