From 19f8e0edb81cfb10a3248fb8459644f7eb4b49f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 6 Jun 2026 13:59:00 +0000 Subject: [PATCH] fix(ci): refresh existing draft release on later pushes The detect_version job treated any existing release (including the draft created by an earlier run) as 'already released' and set is_new_version=false, which skipped the release job. As a result a draft for an unchanged version kept the distribution and target SHA from the first commit, and the edit/clobber path in the release job was effectively unreachable. Distinguish drafts from published releases via gh release view's isDraft field: a published release or git tag is final and is still skipped, while an existing draft now rebuilds so its assets are re-uploaded. Also pass --target on gh release edit so the refreshed draft points at the latest commit. https://claude.ai/code/session_018XCj3HBJS5eEcXCT9dA5GQ --- .github/workflows/build.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b57c131..56377ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,10 +42,21 @@ jobs: echo "version=$version" >> "$GITHUB_OUTPUT" - if git rev-parse --verify --quiet "refs/tags/$version" >/dev/null || \ - gh release view "$version" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then - echo "Version $version already has a tag or release; nothing to publish." + # A published git tag means the version is already released; never rebuild it. + if git rev-parse --verify --quiet "refs/tags/$version" >/dev/null; then + echo "Version $version already has a tag; nothing to publish." echo "is_new_version=false" >> "$GITHUB_OUTPUT" + elif is_draft=$(gh release view "$version" --repo "$GITHUB_REPOSITORY" --json isDraft --jq '.isDraft' 2>/dev/null); then + # A release with this version already exists. Only a published release is + # final: an existing draft must be rebuilt so its assets and target commit + # track the latest push instead of remaining stuck on the first run. + if [[ "$is_draft" == "true" ]]; then + echo "Version $version has an existing draft release; it will be rebuilt and refreshed." + echo "is_new_version=true" >> "$GITHUB_OUTPUT" + else + echo "Version $version already has a published release; nothing to publish." + echo "is_new_version=false" >> "$GITHUB_OUTPUT" + fi else echo "Version $version is new and will be released." echo "is_new_version=true" >> "$GITHUB_OUTPUT" @@ -153,6 +164,7 @@ jobs: gh release edit "$VERSION" \ --repo "$GITHUB_REPOSITORY" \ --draft \ + --target "$GITHUB_SHA" \ --title "$VERSION" \ --notes-file build/tmp/release-note.md gh release upload "$VERSION" "${distributions[@]}" \