Skip to content

Commit 50a669b

Browse files
committed
release CI: make the publish step idempotent
gh release create fails if the release already exists, so re-running the pipeline after force-moving a tag to a fixed commit would error at publish. Detect an existing release and upload its assets with --clobber instead (leaving hand-written notes intact); otherwise create it as before. Tag name is passed via an env var and quoted, per workflow-injection guidance.
1 parent 64dc453 commit 50a669b

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,20 @@ jobs:
515515
(cd dist && sha256sum * > sha256sums.txt)
516516
echo "Release payload:" && ls -la dist/
517517
518-
- name: Create GitHub release
518+
- name: Create or update GitHub release
519519
env:
520520
GH_TOKEN: ${{ github.token }}
521521
TAG: ${{ github.ref_name }}
522522
run: |
523-
gh release create "$TAG" dist/* \
524-
--title "LinSync $TAG" \
525-
--generate-notes \
526-
--verify-tag
523+
# Idempotent so re-running the pipeline (e.g. after force-moving a
524+
# tag to a fixed commit) doesn't fail on an existing release: upload
525+
# and clobber its assets, leaving any hand-written notes intact.
526+
if gh release view "$TAG" >/dev/null 2>&1; then
527+
echo "Release $TAG already exists — uploading assets (clobber)."
528+
gh release upload "$TAG" dist/* --clobber
529+
else
530+
gh release create "$TAG" dist/* \
531+
--title "LinSync $TAG" \
532+
--generate-notes \
533+
--verify-tag
534+
fi

0 commit comments

Comments
 (0)