From 679dedf132206b941fa7f6949653d6c008c6e3bf Mon Sep 17 00:00:00 2001 From: Alan Wizemann Date: Fri, 17 Apr 2026 17:24:31 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20release=20script=20=E2=80=94=20push=20ma?= =?UTF-8?q?in=20+=20tag=20before=20gh=20release=20create?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script was creating the GitHub release before pushing main, which caused gh to auto-create the v tag at the then-current origin HEAD (one commit behind the bump, since main hadn't been pushed yet). The subsequent `git push origin v` was then rejected as non-fast-forward, leaving the remote tag pointing at the wrong commit. Caught during v1.6.2. The remote tag for v1.6.2 was force-corrected to 12610fa (the bump commit); the release artifacts themselves were always correct. New order: push main → tag main locally → push tag → gh release create. Gh will now find the tag already on origin and attach to the right commit. Non-destructive: a retry-safe release can always be resumed. Co-Authored-By: Claude Opus 4.6 --- scripts/release.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index caf4335..8ac8e6b 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -251,6 +251,20 @@ else printf '%s\n' "$APPCAST_ITEM" > "$RELEASE_DIR/appcast-entry.xml" fi +# ---------- push main + tag (skipped for drafts) ---------- +# Order matters: push main and the tag BEFORE `gh release create`, so gh finds +# the tag already on origin and attaches the release to the correct commit. If +# we let gh auto-create the tag, it pins to the then-current origin HEAD — +# which is one commit behind the bump (since we haven't pushed main yet) — +# and the subsequent `git push origin v` gets rejected as non-fast-forward. +if [[ $DRAFT -eq 0 ]]; then + log "Push main" + git push origin main + log "Tag main at v${VERSION} and push tag" + git tag "v${VERSION}" + git push origin "v${VERSION}" +fi + # ---------- github release ---------- log "Create GitHub release and upload artifacts" GH_FLAGS=() @@ -266,13 +280,8 @@ gh release create "v${VERSION}" \ "$UNIVERSAL_ZIP" \ "$ARM64_ZIP" -# ---------- tag main (skipped for drafts) ---------- -if [[ $DRAFT -eq 0 ]]; then - log "Tag main and push" - git tag "v${VERSION}" - git push origin main --tags -else - log "Draft mode — skipping tag. Bump commit is local only; push manually with: git push origin main" +if [[ $DRAFT -eq 1 ]]; then + log "Draft mode — main bump commit is local only; push manually with: git push origin main" fi if [[ $DRAFT -eq 1 ]]; then