Skip to content

Commit 471aa6c

Browse files
committed
Fix workflow to allow releasing with same version
- Add version check before running npm version command - Skip npm version if current version matches target version - Prevents 'Version not changed' error when re-releasing same version
1 parent a1f4955 commit 471aa6c

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,17 @@ jobs:
3737
3838
- name: Update package version
3939
run: |
40-
npm version ${{ inputs.version }} --no-git-tag-version
41-
echo "Updated package.json to version ${{ inputs.version }}"
40+
CURRENT_VERSION=$(node -p "require('./package.json').version")
41+
TARGET_VERSION="${{ inputs.version }}"
42+
echo "Current version: $CURRENT_VERSION"
43+
echo "Target version: $TARGET_VERSION"
44+
45+
if [ "$CURRENT_VERSION" != "$TARGET_VERSION" ]; then
46+
npm version $TARGET_VERSION --no-git-tag-version
47+
echo "Updated package.json to version $TARGET_VERSION"
48+
else
49+
echo "Version is already $TARGET_VERSION, skipping npm version command"
50+
fi
4251
4352
- name: Install dependencies
4453
run: npm install

0 commit comments

Comments
 (0)