fix: create release before uploading artifacts#112
Conversation
The release workflow assumed the release already existed when build jobs tried to upload artifacts. For beta/prerelease tags, no release was created beforehand, causing all three platform builds to fail with "release not found". Add a create-release job that runs first and creates the release (as draft) if it doesn't already exist. All build jobs now depend on it.
There was a problem hiding this comment.
Pull request overview
Adds a preparatory GitHub Actions job to ensure a GitHub Release exists (draft + prerelease for beta/alpha/rc tags) before platform build jobs attempt to upload artifacts, preventing “release not found” failures on fresh prerelease tags.
Changes:
- Introduces a
create-releasejob that creates a draft release (and marks it prerelease for beta/alpha/rc tags) when missing. - Makes
build-macos,build-windows, andbuild-linuxdepend oncreate-releasevianeeds. - Keeps behavior of skipping creation when a release for the tag already exists.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Determine tag | ||
| id: tag | ||
| run: | | ||
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | ||
| tag="${GITHUB_REF_NAME}" | ||
| else | ||
| tag="v$(node -p 'require("./package.json").version')" | ||
| fi | ||
| echo "tag=$tag" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
Determine tag uses node -p ... but this job never installs/pins Node.js (unlike the build jobs which run actions/setup-node). This makes the job depend on whatever Node version happens to be preinstalled on ubuntu-latest, and can fail if Node isn’t present or changes. Add an actions/setup-node step (matching the repo’s pinned version) before running Node, or avoid Node entirely by deriving the tag from the event context/inputs.
Summary
create-releasejob that runs before all platform builds--prereleasefor beta/alpha/rc tags) if one doesn't already existbuild-macos,build-windows,build-linux) nowneeds: create-releaserelease not foundwhen no release exists for the tagRoot cause
The v0.4.0-beta.0 release failed because all 3 build jobs tried to
gh release uploadto a release that didn't exist. Stable releases worked by coincidence (draft releases were accumulating assets from previous runs), but betas had no pre-existing release to upload to.Test plan