Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

GitHub releases become immutable once published, causing "Cannot upload assets to an immutable release" errors when GoReleaser attempts to upload artifacts to already-published releases.

Changes

  • .goreleaser.yaml: Implemented draft-then-publish workflow

    • Changed draft: falsedraft: true to create mutable draft releases
    • Removed mode: replace (not needed for drafts)
    • Added make_latest: true to mark as latest when published
  • .github/workflows/release.yml: Added automatic draft publishing

    • New workflow step to automatically publish draft releases after artifact upload
    • Uses gh release edit with proper security and robustness
  • RELEASE.md: Added comprehensive release process documentation

    • Tag creation and version management (semver)
    • Automated draft-then-publish workflow behavior (triggered on v* tags)
    • Troubleshooting failed releases and re-running releases
    • Pre-release testing with rc tags
    • Notes on draft vs published release mutability

How It Works

  1. Tag pushed → workflow triggered
  2. GoReleaser creates draft release (mutable)
  3. All artifacts uploaded to draft
  4. Workflow automatically publishes the draft release
  5. Published release becomes immutable (but artifacts are already uploaded)

Configuration Changes

# .goreleaser.yaml
release:
  github:
    owner: ericsuh
    name: adapt
- draft: false
+ draft: true
  prerelease: auto
- mode: replace
+ make_latest: true
# .github/workflows/release.yml
- name: Publish draft release
  env:
    GH_TOKEN: ${{ github.token }}
  run: |
    gh release edit "${{ github.ref_name }}" --draft=false --repo="${{ github.repository }}"

This prevents the "Cannot upload assets to an immutable release" error while maintaining full automation.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Change mode from 'replace' to 'append' to avoid clashing with GitHub immutable releases
- Add comprehensive RELEASE.md file documenting the release process

Co-authored-by: ericsuh <382805+ericsuh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Go Releaser configuration for GitHub immutable releases Fix GoReleaser mode for GitHub immutable releases and add release docs Jan 22, 2026
Copilot AI requested a review from ericsuh January 22, 2026 22:35
@ericsuh
Copy link
Owner

ericsuh commented Jan 22, 2026

This is the actual error thrown in the release:

2026-01-22T22:11:55.0045250Z �[1;94m    •�[m �[1mscm releases�[m
2026-01-22T22:11:55.0047288Z �[1;94m      •�[m releasing                                    �[1;94mtag�[m=v0.1.1 �[1;94mrepo�[m=ericsuh/adapt
2026-01-22T22:11:55.8141986Z �[1;94m      •�[m created                                      �[1;94murl�[m=https://github.com/ericsuh/adapt/releases/tag/v0.1.1
2026-01-22T22:11:55.8147252Z �[1;94m      •�[m uploading to release                         �[1;94mfile�[m=dist/adapt_0.1.1-checksums.txt �[1;94mname�[m=adapt_0.1.1-checksums.txt
2026-01-22T22:11:55.8149875Z �[1;94m      •�[m uploading to release                         �[1;94mfile�[m=dist/adapt_0.1.1_linux_x86_64.tar.gz �[1;94mname�[m=adapt_0.1.1_linux_x86_64.tar.gz
2026-01-22T22:11:55.8154324Z �[1;94m      •�[m uploading to release                         �[1;94mfile�[m=dist/adapt_0.1.1_linux_arm64.tar.gz �[1;94mname�[m=adapt_0.1.1_linux_arm64.tar.gz
2026-01-22T22:11:56.2717336Z �[1;93m      •�[m upload failed                                �[1;93mrequest-id�[m=D818:3F9555:3A3C18:47033B:6972A0AB �[1;93merror�[m=POST https://uploads.github.com/repos/ericsuh/adapt/releases/279179884/assets?name=adapt_0.1.1_linux_arm64.tar.gz: 422 Cannot upload assets to an immutable release. [] �[1;93mname�[m=adapt_0.1.1_linux_arm64.tar.gz �[1;93mrelease-id�[m=279179884
2026-01-22T22:11:56.2886907Z �[1;93m      •�[m upload failed                                �[1;93mrequest-id�[m=D818:3F9555:3A3C14:470336:6972A0AB �[1;93merror�[m=POST https://uploads.github.com/repos/ericsuh/adapt/releases/279179884/assets?name=adapt_0.1.1_linux_x86_64.tar.gz: 422 Cannot upload assets to an immutable release. [] �[1;93mname�[m=adapt_0.1.1_linux_x86_64.tar.gz �[1;93mrelease-id�[m=279179884
2026-01-22T22:11:56.3190482Z �[1;93m      •�[m upload failed                                �[1;93mrequest-id�[m=D818:3F9555:3A3C14:470335:6972A0AB �[1;93merror�[m=POST https://uploads.github.com/repos/ericsuh/adapt/releases/279179884/assets?name=adapt_0.1.1-checksums.txt: 422 Cannot upload assets to an immutable release. [] �[1;93mname�[m=adapt_0.1.1-checksums.txt �[1;93mrelease-id�[m=279179884
2026-01-22T22:11:56.3195383Z �[1;91m  ⨯�[m release failed after 43s                         �[1;91merror�[m=scm releases: failed to publish artifacts: failed to upload adapt_0.1.1_linux_arm64.tar.gz: POST https://uploads.github.com/repos/ericsuh/adapt/releases/279179884/assets?name=adapt_0.1.1_linux_arm64.tar.gz: 422 Cannot upload assets to an immutable release. []
2026-01-22T22:11:56.3254159Z ##[error]The process '/opt/hostedtoolcache/goreleaser-action/2.13.3/x64/goreleaser' failed with exit code 1

Copy link
Owner

@ericsuh ericsuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try a different fix. I suspect what we need to do is to create releases in draft mode, then add artifacts, then publish. But to do so, we will need to ensure that the Github Action triggers the release, rather than the reverse.

Copilot AI and others added 3 commits January 26, 2026 04:55
- Change GoReleaser to create draft releases (draft: true)
- Add workflow step to automatically publish draft after artifacts upload
- Remove mode: append as drafts are mutable by default
- Update RELEASE.md to document the draft-then-publish workflow

This fixes the "Cannot upload assets to an immutable release" error by ensuring artifacts are uploaded to a mutable draft release before publishing.

Co-authored-by: ericsuh <382805+ericsuh@users.noreply.github.com>
- Use github.ref_name context instead of manual GITHUB_REF parsing
- Properly quote tag name in gh command for security

Co-authored-by: ericsuh <382805+ericsuh@users.noreply.github.com>
- Include --repo flag for clarity and robustness
- Ensures command works correctly in all workflow contexts

Co-authored-by: ericsuh <382805+ericsuh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

This is the actual error thrown in the release:

Fixed in commit d2043eb. The solution creates releases as drafts (which are mutable), uploads all artifacts, then automatically publishes the draft. This avoids the "Cannot upload assets to an immutable release" error.

Try a different fix. I suspect what we need to do is to create releases in draft mode, then add artifacts, then publish. But to do so, we will need to ensure that the Github Action triggers the releas...

Implemented in commit d2043eb. GoReleaser now creates draft releases, uploads artifacts to the mutable draft, and then the workflow automatically publishes it using gh release edit --draft=false.

Copilot AI changed the title Fix GoReleaser mode for GitHub immutable releases and add release docs Fix GoReleaser immutable release error with draft-then-publish workflow Jan 26, 2026
Copilot AI requested a review from ericsuh January 26, 2026 04:57
@ericsuh ericsuh closed this Jan 26, 2026
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