Skip to content

Reuse existing draft release in goreleaser - #2855

Merged
mikeland73 merged 2 commits into
mainfrom
mikeland73/reuse-draft-release
Jun 21, 2026
Merged

Reuse existing draft release in goreleaser#2855
mikeland73 merged 2 commits into
mainfrom
mikeland73/reuse-draft-release

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

What

Configure goreleaser to reuse an existing draft release on tag push instead of creating a new one.

On tag push, the release job in .github/workflows/cli-release.yml runs goreleaser release --clean. With only draft: true set, goreleaser would generate a fresh release body, which can clobber or duplicate a draft release that already exists for the tag.

Change

In .goreleaser.yaml's release: block:

  • mode: keep-existing — reuse an existing release for the tag and leave its description as-is (just attach the built artifacts). Creates one if none exists.
  • replace_existing_draft: false — explicitly avoid deleting-and-recreating an existing draft, preserving a hand-written description.

Note

GitHub's "get release by tag" API doesn't return drafts, so reuse depends on goreleaser's draft-aware lookup. Worth confirming on the next tag push that artifacts attach to the existing draft rather than spawning a second one.

🤖 Generated with Claude Code

Set mode: keep-existing and replace_existing_draft: false so that a tag
push reuses an existing draft release (preserving its description)
instead of creating a duplicate draft.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikeland73
mikeland73 requested review from Lagoja and Copilot and removed request for CopilotJune 7, 2026 19:37
@mikeland73
mikeland73 requested a review from CopilotJune 21, 2026 17:42

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GoReleaser GitHub release configuration to preserve an existing draft release’s description/body when publishing artifacts for a tag, instead of regenerating (and potentially overwriting) the release notes.

Changes:

  • Set release.mode: keep-existing to keep existing release notes/body when a release already exists.
  • Set release.replace_existing_draft: false to avoid deleting and recreating an existing draft release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread.goreleaser.yaml
Comment on lines +46 to +47
mode: keep-existing
replace_existing_draft: false

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Good catch — added both use_existing_draft: true and replace_existing_artifacts: true in d08ce96. The first resolves exactly the draft-lookup caveat I'd flagged (get-release-by-tag doesn't return drafts), and the second avoids 422s on tag re-runs.

Per PR review: use_existing_draft makes goreleaser find and attach to an
existing draft release (the get-release-by-tag API doesn't return drafts),
and replace_existing_artifacts lets re-runs on the same tag overwrite
assets instead of failing with a 422.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikeland73
mikeland73 merged commit d61167b into mainJun 21, 2026
21 of 24 checks passed
@mikeland73
mikeland73 deleted the mikeland73/reuse-draft-release branch June 21, 2026 17:50
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@mikeland73