Skip to content

Commit 372eb78

Browse files
author
Test User
committed
fix: align npm version update with recommended approach
- Use TARGET variable name for clarity - Use node -p instead of node -e for cleaner code - Match exact message format from recommendation - Conditional check prevents 'Version not changed' error
1 parent b84c50c commit 372eb78

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ jobs:
8484
8585
- name: Update package.json version
8686
run: |
87-
TAG_VERSION="${{ steps.get_version.outputs.version }}"
88-
echo "Tag version: $TAG_VERSION"
89-
CURRENT=$(node -e "console.log(require('./package.json').version)")
87+
TARGET="${{ steps.get_version.outputs.version }}"
88+
echo "Target version from tag: $TARGET"
89+
CURRENT=$(node -p "require('./package.json').version")
9090
echo "Current package.json version: $CURRENT"
91-
if [ "$CURRENT" = "$TAG_VERSION" ]; then
92-
echo "Version already matches tag — skipping npm version"
91+
if [ "$CURRENT" != "$TARGET" ]; then
92+
npm version "$TARGET" --no-git-tag-version
9393
else
94-
npm version "$TAG_VERSION" --no-git-tag-version
94+
echo "package.json already at version $CURRENT; skipping npm version"
9595
fi
9696
9797
- name: Verify package.json

0 commit comments

Comments
 (0)