Skip to content

Commit d700bef

Browse files
author
Test User
committed
fix: use direct JSON edit instead of npm version to avoid 'Version not changed' error
- Replace npm version command with direct package.json manipulation - Prevents error when version already matches tag - More robust and reliable approach
1 parent 792ef8c commit d700bef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ jobs:
7878
7979
- name: Update package.json version
8080
run: |
81-
CURRENT_VERSION=$(node -p "require('./package.json').version")
8281
TAG_VERSION="${{ steps.get_version.outputs.version }}"
82+
CURRENT_VERSION=$(node -p "require('./package.json').version")
83+
echo "Current version: $CURRENT_VERSION"
84+
echo "Tag version: $TAG_VERSION"
8385
if [ "$CURRENT_VERSION" != "$TAG_VERSION" ]; then
8486
echo "Updating version from $CURRENT_VERSION to $TAG_VERSION"
85-
npm version $TAG_VERSION --no-git-tag-version
87+
node -e "const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('package.json')); pkg.version = '$TAG_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
8688
else
87-
echo "Version already matches tag: $CURRENT_VERSION"
89+
echo "Version already matches tag: $CURRENT_VERSION - skipping update"
8890
fi
8991
9092
- name: Verify package.json

0 commit comments

Comments
 (0)