From a7a5f66f0edd70e0cf8bd85a3064b869f3e2a88f Mon Sep 17 00:00:00 2001 From: ManulParihar Date: Wed, 2 Sep 2026 17:29:03 +0530 Subject: [PATCH] Trigger releases from a PR label instead of commit message A merge commit doesn't carry the "Release" text from a squashed branch commit, so the publish workflow silently skipped v3.0.0. Now it fires on any PR to main merged with a Release label, and runs the test suite before publishing. --- .github/workflows/npm_publish.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm_publish.yaml b/.github/workflows/npm_publish.yaml index 41f11f7..c6f1c13 100644 --- a/.github/workflows/npm_publish.yaml +++ b/.github/workflows/npm_publish.yaml @@ -1,7 +1,8 @@ name: Publish SDK on: - push: + pull_request: + types: [ closed ] branches: [ "main" ] permissions: @@ -10,11 +11,13 @@ permissions: jobs: publish-npm: - if: contains(github.event.head_commit.message, 'Release') + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'Release') runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} - uses: actions/setup-node@v4 with: @@ -26,13 +29,16 @@ jobs: run: | VERSION=$(node -p "require('./package.json').version") echo "version=$VERSION" >> $GITHUB_OUTPUT - + - name: Install dependencies run: npm ci - name: Build run: npm run build + - name: Test + run: npm test + - name: Publish to npm run: npm publish --access public