From f2a4722d040d543ad38620b6c0e0bd3fd52fd95c Mon Sep 17 00:00:00 2001 From: Sahilb315 Date: Wed, 27 Aug 2025 18:03:04 +0530 Subject: [PATCH] use head_branch for extracting tag --- .github/workflows/publish-npm.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 9779fca..5658e93 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -24,12 +24,12 @@ jobs: - name: Extract Tag Version id: version run: | - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - TAG_VERSION="${{ github.ref }}" - TAG_VERSION="${TAG_VERSION#refs/tags/}" - echo "version=$TAG_VERSION" >> $GITHUB_OUTPUT + TAG_VERSION="${{ github.event.workflow_run.head_branch }}" + if [[ "$TAG_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + VERSION="${TAG_VERSION#v}" # Remove leading 'v' + echo "version=$VERSION" >> $GITHUB_OUTPUT else - echo "No tag found." + echo "No valid tag found in head_branch: $TAG_VERSION" exit 1 fi - name: Prepare package