Skip to content

Commit 17cddb5

Browse files
authored
fix(release): publish as draft until desktop assets upload (#802)
The release flow previously promoted a tag to "latest" the moment the CLI publish step completed (via `gh release create --latest`). The desktop build then ran for another 15-20 min before attaching DMG/zip/exe/AppImage/ deb/rpm/latest*.yml, leaving `/releases/latest/download/<desktop-asset>` to 404 for any user hitting it during that window. Create the release as a draft instead, and flip `--draft=false` as the final step of publish-desktop.yml once every asset is uploaded. GitHub auto-promotes the undrafted release to "latest" based on semver. While in draft, `/releases/latest/...` continues to redirect to the previous release, so install.sh and the download links in release notes keep working. Also harden the upload loop: drop the `|| true` that was swallowing upload failures, switch to `set -euo pipefail` and process substitution so a failed `gh release upload` aborts the job instead of silently leaving the release short an asset.
1 parent efb271c commit 17cddb5

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

.github/workflows/publish-desktop.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,18 @@ jobs:
170170
env:
171171
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172172
run: |
173-
find artifacts -type f \
173+
set -euo pipefail
174+
while IFS= read -r file; do
175+
echo "Uploading: $file"
176+
gh release upload "$RELEASE_TAG" "$file" --repo "$GITHUB_REPOSITORY" --clobber
177+
done < <(find artifacts -type f \
174178
\( -name "*.dmg" -o -name "*.zip" -o -name "*.exe" \
175179
-o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" \
176-
-o -name "latest*.yml" \) | while read file; do
177-
echo "Uploading: $file"
178-
gh release upload "$RELEASE_TAG" "$file" --repo "$GITHUB_REPOSITORY" --clobber || true
179-
done
180+
-o -name "latest*.yml" \))
181+
182+
# Flip draft → published only after every desktop asset is uploaded —
183+
# this is the atomic point where the new tag becomes "latest".
184+
- name: Promote release (draft → published)
185+
env:
186+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
187+
run: gh release edit "$RELEASE_TAG" --draft=false --repo "$GITHUB_REPOSITORY"

apps/cli/src/release.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ const syncGitHubRelease = async (input: {
200200
const notesPath = resolve(cliRoot, "release-notes", "next.md");
201201
const notesFile = existsSync(notesPath) ? notesPath : null;
202202

203+
// Draft until publish-desktop.yml finishes uploading installers and flips
204+
// it; otherwise /releases/latest/download/<desktop-asset> 404s during the
205+
// ~15-20 min desktop build window.
203206
const args = [
204207
"release",
205208
"create",
@@ -211,12 +214,11 @@ const syncGitHubRelease = async (input: {
211214
input.tag,
212215
...(notesFile ? ["--notes-file", notesFile] : ["--generate-notes"]),
213216
"--verify-tag",
217+
"--draft",
214218
];
215219

216220
if (input.channel === "beta") {
217221
args.push("--prerelease");
218-
} else {
219-
args.push("--latest");
220222
}
221223

222224
await runCommand({

0 commit comments

Comments
 (0)