Skip to content

Commit 26c15ec

Browse files
ci: draft-then-publish releases to close the empty public window
Previously create-release published an empty release immediately, leaving a 1-2 minute window where the public saw a partial release while the upload matrix attached assets. Now the release is created as a draft, the upload matrix attaches all 10 assets to the draft (still serialized so there is no create race), and a final publish-release job flips draft to false only after every asset is present. The release becomes public in one step with the full asset set. The upload-assets matrix sets draft: true explicitly because the action's draft input defaults to false and would otherwise publish the draft early on each update call. Preserves the 5 platform targets, asset names, 10 total assets, checksums, GITHUB_TOKEN, and contents: write only on the release-related jobs. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5951630 commit 26c15ec

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

.github/workflows/go.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ jobs:
5050
# matrix below then only adds files to this already-existing release and can
5151
# never race to create it (the race that made action-gh-release v3 fail with
5252
# "already_exists (tag_name)").
53+
#
54+
# The release is created as a draft so it is not publicly visible while the
55+
# upload matrix is still attaching assets. The publish-release job flips it to
56+
# published only after all assets are present, so the public never sees a
57+
# partial or empty release.
5358
create-release:
5459
needs: build
5560
if: startsWith(github.ref, 'refs/tags/v')
@@ -58,8 +63,10 @@ jobs:
5863
contents: write
5964

6065
steps:
61-
- name: Ensure release exists for tag
66+
- name: Create draft release for tag
6267
uses: softprops/action-gh-release@v3
68+
with:
69+
draft: true
6370
env:
6471
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6572

@@ -137,12 +144,33 @@ jobs:
137144

138145
# The release already exists (created by create-release), so each matrix leg
139146
# only adds its binary and checksum. No matrix job creates the release, which
140-
# avoids the concurrent-create race entirely.
141-
- name: Upload assets to release
147+
# avoids the concurrent-create race entirely. draft: true is set explicitly
148+
# so these update calls keep the release in draft (the action's draft input
149+
# defaults to false and would otherwise publish it early).
150+
- name: Upload assets to draft release
142151
uses: softprops/action-gh-release@v3
143152
with:
153+
draft: true
144154
files: |
145155
${{ matrix.asset_name }}
146156
${{ matrix.asset_name }}.sha256
147157
env:
148158
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159+
160+
# Single job that publishes the release once, only after the full asset set is
161+
# attached. Flipping draft to false here is the moment the release becomes
162+
# public, so there is no window where a partial or empty release is visible.
163+
publish-release:
164+
needs: upload-assets
165+
if: startsWith(github.ref, 'refs/tags/v')
166+
runs-on: ubuntu-latest
167+
permissions:
168+
contents: write
169+
170+
steps:
171+
- name: Publish release
172+
uses: softprops/action-gh-release@v3
173+
with:
174+
draft: false
175+
env:
176+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)