Skip to content

Commit 0d54c7a

Browse files
Remove explicit tag push; rely on gh release create draft atomicity
The explicit git push step published the tag before any release or assets existed, creating a window where the tag was public with nothing attached. If gh release create then failed, the tag was permanently stranded. New sequence: - gh release create --draft --target <sha>: uploads all assets, tag not yet public (GitHub defers the ref until the draft is published) - gh release edit --draft=false: tag and release become public together Also adds: - set -euo pipefail + shopt -s failglob so an empty dist/ or any command failure exits loudly before touching GitHub - Cleanup step (if: failure()) that deletes a leftover draft so the next run is not blocked; --cleanup-tag is best-effort (|| true) since the org immutable-tag policy may prevent tag deletion, but the release deletion alone is sufficient to unblock a retry Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 21c8990 commit 0d54c7a

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,36 @@ jobs:
141141
env:
142142
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
143143

144-
- name: Push tag
145-
run: git push origin "${{ inputs.tag }}"
146-
147144
- name: Create GitHub Release
148145
env:
149146
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150147
run: |
148+
set -euo pipefail
149+
shopt -s failglob
150+
151+
common=(
152+
"${{ inputs.tag }}"
153+
dist/*.tar.gz dist/*.zip dist/*checksums*
154+
--target "${{ github.sha }}"
155+
--title "Checkmarx One CLI ${{ inputs.tag }}"
156+
--generate-notes
157+
--draft
158+
)
159+
151160
if [ "${{ inputs.dev }}" = "true" ]; then
152-
gh release create "${{ inputs.tag }}" dist/*.tar.gz dist/*.zip dist/*checksums* \
153-
--title "Checkmarx One CLI ${{ inputs.tag }}" \
154-
--generate-notes \
155-
--prerelease \
156-
--draft
157-
gh release edit "${{ inputs.tag }}" --draft=false
161+
gh release create "${common[@]}" --prerelease
162+
gh release edit "${{ inputs.tag }}" --draft=false
158163
else
159-
gh release create "${{ inputs.tag }}" dist/*.tar.gz dist/*.zip dist/*checksums* \
160-
--title "Checkmarx One CLI ${{ inputs.tag }}" \
161-
--generate-notes \
162-
--draft
163-
gh release edit "${{ inputs.tag }}" --draft=false --latest
164+
gh release create "${common[@]}"
165+
gh release edit "${{ inputs.tag }}" --draft=false --latest
164166
fi
165167
168+
- name: Cleanup draft release on failure
169+
if: failure()
170+
env:
171+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+
run: gh release delete "${{ inputs.tag }}" --cleanup-tag --yes || true
173+
166174
notify:
167175
name: Update Teams & JIRA About New Release
168176
if: inputs.dev == false && 1 == 0

0 commit comments

Comments
 (0)