From 3126211a6a2d43bb1e98054b23f2a2a64991486b Mon Sep 17 00:00:00 2001 From: Petr Heinz Date: Wed, 30 Sep 2026 18:28:33 +0200 Subject: [PATCH] Retry builds the tagged commit, wherever main is retry insisted that the version commit is HEAD, but main moves on as soon as anything else is merged, as happened between the failed 0.1.18 release and its retry. The retry now checks out the tag of the version in lib/*/version.rb and rebuilds that commit. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/release.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 137ef3e..39cea30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,10 +18,10 @@ # both, pushes the gem to RubyGems.org and creates a GitHub release with auto-generated notes for # the tag; edit the notes afterwards if needed. # -# Retry: if a release failed after the version commit was pushed, run "retry" right away from -# main. It bumps nothing, rebuilds the tagged commit, pushes the gem if RubyGems.org is still -# missing it and creates the GitHub release if it is still missing. Running patch or minor again -# would release the next version instead. +# Retry: if a release failed after the version commit was pushed, run "retry" from main. It bumps +# nothing, checks out the tag of the version in lib/*/version.rb and rebuilds that commit, pushes +# the gem if RubyGems.org is still missing it and creates the GitHub release if it is still +# missing. Running patch or minor again would release the next version instead. # # Dry run: bumps in place without committing, builds the gem and, on main, exchanges the # workflow's OIDC token with RubyGems.org, which proves that the trusted publisher matches this @@ -111,7 +111,9 @@ jobs: tagged = `git tag --points-at HEAD`.split.include?("v#{current}") if release == "retry" - abort("retry only finishes a release whose version commit v#{current} is HEAD") unless tagged + # main may have moved on since the version commit, so build what the tag points at + abort("retry only finishes a release whose version v#{current} is tagged") unless system("git", "rev-parse", "-q", "--verify", "refs/tags/v#{current}", out: File::NULL) + system("git", "checkout", "-q", "v#{current}") || abort("could not check out v#{current}") version = current else abort("HEAD is already released as v#{current}, there is nothing new to release") if tagged && !dry_run