Skip to content

Commit 9c8c9b4

Browse files
committed
ci: make publish workflow idempotent for pre-bumped versions
1 parent 16ba01d commit 9c8c9b4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: npm run ci
3333

3434
- name: Set package version
35-
run: npm version "${{ inputs.version }}" --no-git-tag-version
35+
run: npm version "${{ inputs.version }}" --no-git-tag-version --allow-same-version
3636

3737
- name: Build
3838
run: npm run build
@@ -48,7 +48,7 @@ jobs:
4848
git config user.name "github-actions[bot]"
4949
git config user.email "github-actions[bot]@users.noreply.github.com"
5050
git add package.json package-lock.json
51-
git commit -m "release: v${{ inputs.version }}"
52-
git tag "v${{ inputs.version }}"
51+
git diff --cached --quiet && echo "Nothing to commit" || git commit -m "release: v${{ inputs.version }}"
52+
git tag "v${{ inputs.version }}" 2>/dev/null || echo "Tag already exists"
5353
git push origin HEAD
54-
git push origin "v${{ inputs.version }}"
54+
git push origin "v${{ inputs.version }}" 2>/dev/null || echo "Tag already pushed"

0 commit comments

Comments
 (0)