Skip to content

Commit 6aab9d5

Browse files
committed
fix(release): atomic publish — un-draft GH release only after registries succeed
Previously the un-draft step ran inside the verify job, before publish-registries. If npm or PyPI publish failed, the GitHub release was already live but the wrappers were not — half-shipped state. Move the un-draft into a new publish-final job that needs both [verify, publish-registries]. If any registry fails, the GH release stays in draft and the run can be re-tried with replace=true.
1 parent 4cdc2dc commit 6aab9d5

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,13 @@ jobs:
251251
gh release edit "$VERSION" \
252252
--notes-file /tmp/release_notes.md --repo "$GITHUB_REPOSITORY"
253253
254-
- name: Publish release
255-
env:
256-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
257-
VERSION: ${{ inputs.version }}
258-
run: gh release edit "$VERSION" --draft=false --repo "$GITHUB_REPOSITORY"
259-
260254
# ── 8. Publish package wrappers (npm + PyPI) ──────────────────
261255
# Wrappers in pkg/npm and pkg/pypi download the released binary at
262256
# install time, so they only need a version bump (already in the repo
263257
# at this point) — no per-release sha256 substitution.
258+
#
259+
# Runs against the still-DRAFT GitHub release. If publish fails, the
260+
# release stays in draft so we can re-run without a half-shipped state.
264261
publish-registries:
265262
needs: [verify]
266263
runs-on: ubuntu-latest
@@ -301,3 +298,19 @@ jobs:
301298
TWINE_USERNAME: __token__
302299
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
303300
run: twine upload --non-interactive dist/*
301+
302+
# ── 9. Atomic un-draft (only after npm + PyPI succeed) ────────
303+
# The GitHub release stays in DRAFT until both registries publish.
304+
# If anything upstream fails, the draft can be deleted and the run
305+
# re-tried with replace=true — no half-shipped state visible to users.
306+
publish-final:
307+
needs: [verify, publish-registries]
308+
runs-on: ubuntu-latest
309+
permissions:
310+
contents: write
311+
steps:
312+
- name: Un-draft GitHub release
313+
env:
314+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
315+
VERSION: ${{ inputs.version }}
316+
run: gh release edit "$VERSION" --draft=false --repo "$GITHUB_REPOSITORY"

0 commit comments

Comments
 (0)