Skip to content

Commit b84c50c

Browse files
author
Test User
committed
fix: use conditional check for npm version update (preferred approach)
- Only run npm version when package.json version differs from tag - Skip npm version command when versions already match - Add debug step to show GITHUB_REF and package.json version - More efficient than --allow-same-version (skips unnecessary command)
1 parent 88f2de1 commit b84c50c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,23 @@ jobs:
7676
echo "version=$VERSION" >> $GITHUB_OUTPUT
7777
echo "Publishing version: $VERSION"
7878
79+
- name: Debug version
80+
run: |
81+
echo "GITHUB_REF: $GITHUB_REF"
82+
echo "Resolved version: ${GITHUB_REF#refs/tags/v}"
83+
node -e "console.log('package.json version =', require('./package.json').version)"
84+
7985
- name: Update package.json version
8086
run: |
81-
npm version "${{ steps.get_version.outputs.version }}" --no-git-tag-version --allow-same-version
87+
TAG_VERSION="${{ steps.get_version.outputs.version }}"
88+
echo "Tag version: $TAG_VERSION"
89+
CURRENT=$(node -e "console.log(require('./package.json').version)")
90+
echo "Current package.json version: $CURRENT"
91+
if [ "$CURRENT" = "$TAG_VERSION" ]; then
92+
echo "Version already matches tag — skipping npm version"
93+
else
94+
npm version "$TAG_VERSION" --no-git-tag-version
95+
fi
8296
8397
- name: Verify package.json
8498
run: |

0 commit comments

Comments
 (0)