Skip to content

Commit 91dba03

Browse files
fix(ci): allow same version in npm publish workflow
Add --allow-same-version to npm version commands so the publish workflow doesn't fail when package.json already contains the target version. Also skip the version bump commit when there are no changes.
1 parent f7ccf14 commit 91dba03

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828

2929
- name: Update version in package.json files
3030
run: |
31-
npm version "${{ steps.version.outputs.VERSION }}" --no-git-tag-version
32-
npm version "${{ steps.version.outputs.VERSION }}" --no-git-tag-version -w packages/plugin
31+
npm version "${{ steps.version.outputs.VERSION }}" --no-git-tag-version --allow-same-version
32+
npm version "${{ steps.version.outputs.VERSION }}" --no-git-tag-version --allow-same-version -w packages/plugin
3333
3434
- name: Install dependencies
3535
run: npm ci
@@ -51,10 +51,10 @@ jobs:
5151
- name: Publish root package
5252
run: npm publish --access public
5353

54-
- name: Commit version bump
54+
- name: Commit version bump (if needed)
5555
run: |
5656
git config user.name "github-actions[bot]"
5757
git config user.email "github-actions[bot]@users.noreply.github.com"
5858
git add package.json packages/plugin/package.json package-lock.json
59-
git commit -m "chore: bump version to ${{ steps.version.outputs.VERSION }}"
60-
git push origin HEAD:main
59+
git diff --cached --quiet && echo "No version changes to commit" || \
60+
(git commit -m "chore: bump version to ${{ steps.version.outputs.VERSION }}" && git push origin HEAD:main)

0 commit comments

Comments
 (0)