From aca1e4dddae2d3dd0c68f21c1f83a3a3f509c74f Mon Sep 17 00:00:00 2001 From: Eddie A Tejeda <669988+eddietejeda@users.noreply.github.com> Date: Wed, 27 May 2026 19:13:18 -0700 Subject: [PATCH] fix: handle pre-existing draft release in host job The plan job calls `dist host --steps=create` which pre-creates the GitHub release as a draft. When the host job later runs `gh release create`, it fails with "a release with the same tag name already exists", which blocks the custom-publish-homebrew job from running. Fix by checking if the release already exists and using `gh release edit` + `gh release upload --clobber` instead of `gh release create` in that case. --- .github/workflows/release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9075f88..15c19f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -276,7 +276,14 @@ jobs: # Write and read notes from a file to avoid quoting breaking things echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt - gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + # The plan job runs `dist host --steps=create` which pre-creates the draft release. + # If the release already exists, edit it in place; otherwise create it fresh. + if gh release view "${{ needs.plan.outputs.tag }}" > /dev/null 2>&1; then + gh release edit "${{ needs.plan.outputs.tag }}" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" + gh release upload "${{ needs.plan.outputs.tag }}" artifacts/* --clobber + else + gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + fi custom-publish-homebrew: needs: