diff --git a/.github/workflows/labeled_pull_request.yml b/.github/workflows/labeled_pull_request.yml new file mode 100644 index 000000000..dddf37af8 --- /dev/null +++ b/.github/workflows/labeled_pull_request.yml @@ -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 }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99fa82ba0..225b2a36c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }}