Skip to content

Commit

Permalink
chore(Root): add labeled pr workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kikoruiz committed Aug 22, 2024
1 parent a111563 commit 08c550a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 33 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/labeled_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Labeled Pull Requests

on:
pull_request:
types: [labeled]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
publish-tagged-packages:
name: Publish Tagged Packages to NPM
if: github.ref != 'refs/heads/master' && contains(github.event.pull_request.labels.*.name, 'feature')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install
run: npm install -D commander execa prettier

- name: Get Files
id: files
uses: jitterbit/get-changed-files@v1
with:
format: 'json'

- name: Publish Packages
run: npm run publish-tagged-packages -- --tag '${{ github.event.pull_request.head.ref }}' --files '${{ steps.files.outputs.added_modified }}'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33 changes: 0 additions & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
GITHUB_USER: sui-bot
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

publish-tagged-packages:
name: Publish Tagged Packages to NPM
needs: checks
if: github.ref != 'refs/heads/master' && contains(github.event.pull_request.labels.*.name, 'feature')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install
run: npm install -D commander execa prettier

- name: Get Files
id: files
uses: jitterbit/get-changed-files@v1
with:
format: 'json'

- name: Publish Packages
run: npm run publish-tagged-packages -- --tag '${{ github.event.pull_request.head.ref }}' --files '${{ steps.files.outputs.added_modified }}'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 08c550a

Please sign in to comment.