Skip to content

Commit febd3d9

Browse files
BrainSlugs83Copilot
andcommitted
fix: resilient publish — idempotent commit/tag/push
- Skip commit if package.json already at target version - Force-update tag (handles retry after partial failure) - Push commit and tag separately to avoid partial failures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fa73be1 commit febd3d9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,21 @@ jobs:
3131

3232
- run: npm run check
3333

34-
# Commit version bump, tag, and push
35-
- name: Commit and tag
34+
# Commit version bump (if changed), tag, and push
35+
- name: Commit, tag, and push
3636
run: |
3737
git config user.name "github-actions[bot]"
3838
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3939
git add package.json package-lock.json
40-
git commit -m "v${{ inputs.version }}"
41-
git tag "v${{ inputs.version }}"
42-
git push origin main --tags
40+
git diff --cached --quiet || git commit -m "v${{ inputs.version }}"
41+
git tag -f "v${{ inputs.version }}"
42+
git push origin main
43+
git push origin "v${{ inputs.version }}" --force
4344
4445
# Create GitHub Release from the new tag
4546
- name: Create GitHub Release
4647
env:
4748
GH_TOKEN: ${{ github.token }}
48-
run: gh release create "v${{ inputs.version }}" --generate-notes
49+
run: gh release create "v${{ inputs.version }}" --generate-notes --latest
4950

5051
- run: npm publish --provenance --access public

0 commit comments

Comments
 (0)