From 6ec76cbf3d6190c6e6ca913479e3d03fac3f1240 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Mon, 16 Mar 2026 06:05:25 -0700 Subject: [PATCH 1/3] Update release workflow to permit shipping from non main branches --- .github/workflows/releases.yml | 39 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index d6e932c12d..df2314cfa4 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,6 +1,6 @@ name: Publish NPM -run-name: Publish NPM - ${{ github.event.inputs.package }} +run-name: Publish NPM - ${{ inputs.package }}@${{ inputs.npm-tag }} from ${{ inputs.branch }} on: workflow_dispatch: @@ -20,7 +20,16 @@ on: - http-client - io - tool-cache - + branch: + type: string + required: false + default: 'main' + description: 'Branch to release from' + npm-tag: + type: string + required: false + default: 'latest' + description: 'npm dist-tag to publish under (e.g. latest, next, beta)' jobs: test: @@ -28,13 +37,15 @@ jobs: steps: - name: setup repo - uses: actions/checkout@v5 + uses: actions/checkout@v6 + with: + ref: ${{ inputs.branch }} - name: verify package exists run: ls packages/${{ github.event.inputs.package }} - name: Set Node.js 24.x - uses: actions/setup-node@v5 + uses: actions/setup-node@v6 with: node-version: 24.x @@ -55,7 +66,7 @@ jobs: working-directory: packages/${{ github.event.inputs.package }} - name: upload artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ github.event.inputs.package }} path: packages/${{ github.event.inputs.package }}/*.tgz @@ -70,29 +81,35 @@ jobs: steps: - name: Set Node.js 24.x - uses: actions/setup-node@v5 + uses: actions/setup-node@v6 with: node-version: 24.x - name: download artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: - name: ${{ github.event.inputs.package }} + name: ${{ inputs.package }} + + - name: guard against publishing latest from non-main branch + if: inputs.branch != 'main' && inputs.npm-tag == 'latest' + run: | + echo "::error::Publishing with the 'latest' dist-tag from a non-main branch ('${{ inputs.branch }}') is not allowed. Use a different npm-tag (e.g. next, beta)." + exit 1 - name: publish - run: npm publish --provenance *.tgz + run: npm publish --provenance --tag "${{ inputs.npm-tag }}" *.tgz - name: notify slack on failure if: failure() run: | - curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Failed to publish a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK + curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Failed to publish a new version of ${{ inputs.package }} from ${{ inputs.branch }} (tag: ${{ inputs.npm-tag }})"}' $SLACK_WEBHOOK env: SLACK_WEBHOOK: ${{ secrets.SLACK }} - name: notify slack on success if: success() run: | - curl -X POST -H 'Content-type: application/json' --data '{"text":":dance: Successfully published a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK + curl -X POST -H 'Content-type: application/json' --data '{"text":":dance: Successfully published a new version of ${{ inputs.package }} from ${{ inputs.branch }} (tag: ${{ inputs.npm-tag }})"}' $SLACK_WEBHOOK env: SLACK_WEBHOOK: ${{ secrets.SLACK }} From 99dfdab1942e8b52c4eec3a18c901ebcb28e5c55 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Mon, 16 Mar 2026 06:14:29 -0700 Subject: [PATCH 2/3] Fix the description of npm-tag --- .github/workflows/releases.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index df2314cfa4..e9beb5ba14 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -1,6 +1,6 @@ name: Publish NPM -run-name: Publish NPM - ${{ inputs.package }}@${{ inputs.npm-tag }} from ${{ inputs.branch }} +run-name: Publish NPM - ${{ inputs.package }} from ${{ inputs.branch }} on: workflow_dispatch: @@ -29,7 +29,7 @@ on: type: string required: false default: 'latest' - description: 'npm dist-tag to publish under (e.g. latest, next, beta)' + description: 'npm dist-tag for the release. Use "latest" for main branch releases. For non-main branches, use the package major version (e.g. "v5") to avoid overwriting the latest tag.' jobs: test: @@ -93,7 +93,7 @@ jobs: - name: guard against publishing latest from non-main branch if: inputs.branch != 'main' && inputs.npm-tag == 'latest' run: | - echo "::error::Publishing with the 'latest' dist-tag from a non-main branch ('${{ inputs.branch }}') is not allowed. Use a different npm-tag (e.g. next, beta)." + echo "::error::Publishing with the 'latest' dist-tag from a non-main branch ('${{ inputs.branch }}') is not allowed. Use the package major version as the tag (e.g. v5)." exit 1 - name: publish From ed4fdc98c4f80cd75528f196baedbab999ffd2c1 Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Mon, 16 Mar 2026 06:50:25 -0700 Subject: [PATCH 3/3] Add input to run isolated tests --- .github/workflows/releases.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index e9beb5ba14..667b7959ad 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -30,6 +30,11 @@ on: required: false default: 'latest' description: 'npm dist-tag for the release. Use "latest" for main branch releases. For non-main branches, use the package major version (e.g. "v5") to avoid overwriting the latest tag.' + test-all: + type: boolean + required: false + default: false + description: 'Run tests for all packages instead of only the package being published' jobs: test: @@ -59,7 +64,12 @@ jobs: run: npm run build - name: test - run: npm run test + run: | + if [ "${{ inputs.test-all }}" = "true" ]; then + npm run test + else + npm run test -- --testPathPattern="packages/${{ inputs.package }}" + fi - name: pack run: npm pack