Skip to content

Commit 792ef8c

Browse files
author
Test User
committed
fix: npm publish workflow - handle version already set in package.json
- Check if package.json version matches tag before updating - Skip version update if versions already match - Prevents 'Version not changed' error when package.json is pre-updated
1 parent 69b4bcf commit 792ef8c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ jobs:
7878
7979
- name: Update package.json version
8080
run: |
81-
npm version ${{ steps.get_version.outputs.version }} --no-git-tag-version
81+
CURRENT_VERSION=$(node -p "require('./package.json').version")
82+
TAG_VERSION="${{ steps.get_version.outputs.version }}"
83+
if [ "$CURRENT_VERSION" != "$TAG_VERSION" ]; then
84+
echo "Updating version from $CURRENT_VERSION to $TAG_VERSION"
85+
npm version $TAG_VERSION --no-git-tag-version
86+
else
87+
echo "Version already matches tag: $CURRENT_VERSION"
88+
fi
8289
8390
- name: Verify package.json
8491
run: |

0 commit comments

Comments
 (0)