Skip to content

fix(ci): publish release as draft to support immutable releases#1558

Merged
fengmk2 merged 2 commits into
mainfrom
fix/ci-release-immutable-draft
May 12, 2026
Merged

fix(ci): publish release as draft to support immutable releases#1558
fengmk2 merged 2 commits into
mainfrom
fix/ci-release-immutable-draft

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented May 12, 2026

Summary

The release workflow fails on the asset-upload step on repos with GitHub's immutable releases feature enabled. Failing run: https://github.com/voidzero-dev/vite-plus/actions/runs/25673521844/job/75370568926

Cannot upload asset vp-setup-x86_64-pc-windows-msvc.exe to an immutable release.
GitHub only allows asset uploads before a release is published, but draft
prereleases publish with the release.published event instead of release.prereleased.

softprops/action-gh-release creates prerelease: true, draft: false in a single API call, so the release is already published by the time assets upload. On immutable repos that's rejected.

Fix

  • Create the release as a draft so assets attach while it's still mutable.
  • Add a follow-up gh release edit ... --draft=false step to publish it.

The single release.published event still fires once, after assets are in place. GITHUB_TOKEN already has contents: write on the Release job, which is all gh release edit needs.

Test plan

  • Trigger a manual Release workflow run with npm_tag: alpha and verify both the Create GitHub Release (draft) and Publish GitHub Release steps succeed
  • Confirm assets (vp-setup-*.exe) appear on the published release
  • Confirm the GitHub release transitions from draft to published prerelease

The repo has GitHub's immutable-releases feature enabled. softprops/action-gh-release
creates `prerelease: true, draft: false` releases in a single API call, so asset
uploads happen after the release is already published — which fails on immutable
repos with "Cannot upload asset ... to an immutable release".

Switch to `draft: true` so the action attaches assets while the release is still
mutable, then publish via `gh release edit` afterwards. The release.published
event still fires once, after assets are in place.

Closes: https://github.com/voidzero-dev/vite-plus/actions/runs/25673521844/job/75370568926
@fengmk2 fengmk2 self-assigned this May 12, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit e134e4f
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a02d504c9a9e10008b19ce3

@fengmk2 fengmk2 marked this pull request as ready for review May 12, 2026 07:52
@fengmk2
Copy link
Copy Markdown
Member Author

fengmk2 commented May 12, 2026

@fengmk2 fengmk2 requested review from Boshen, branchseer and cpojer May 12, 2026 07:52
@fengmk2 fengmk2 merged commit 6f02dee into main May 12, 2026
50 checks passed
@fengmk2 fengmk2 deleted the fix/ci-release-immutable-draft branch May 12, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants