Skip to content

Commit 009e119

Browse files
dblockclaude
andcommitted
Document recovery when the default branch advances mid-release
A merge after the tag check and before the release push leaves the gem published while the push fails, and reruns cannot recover. Document the manual recovery from the preserved artifacts in the workflow reference: verify the published digest, push the tag from the bundle, merge the release commit through a pull request, create the GitHub Release, and start the next iteration. Warn against merging while a release runs, and point to it from RELEASING.md, README, and the composite action docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Gr21hZDQo5axDMuFgzL6s
1 parent 21d0470 commit 009e119

5 files changed

Lines changed: 45 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [#90](https://github.com/dblock/ruby-gem-release/pull/90): Publish the released changelog section as GitHub Release notes in the standard workflow instead of generated notes, read before any publication - [@dblock](https://github.com/dblock).
66
- [#91](https://github.com/dblock/ruby-gem-release/pull/91): Accept an Intridea Next section with release notes but no contribution placeholder, rejecting a placeholder marked differently from the configured one - [@dblock](https://github.com/dblock).
7+
- [#92](https://github.com/dblock/ruby-gem-release/pull/92): Document manual recovery from the preserved bundle when the default branch advances during publication - [@dblock](https://github.com/dblock).
78
- Your contribution here.
89

910
## 0.9.0 (2026/11/20)

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Collaborators with write access can dispatch releases after this setup, without
7676

7777
### 4. Make a Release
7878

79-
Your branch rules must permit release commits and tags to be pushed; see [branch permissions](RELEASING.md#one-time-setup). Each release checks this before publishing. Dispatching starts a publishing run; when required reviewers are configured, the release job waits for approval from a designated maintainer. Run your project's tests and build checks, review the changes, and dispatch from your default branch:
79+
Your branch rules must permit release commits and tags to be pushed; see [branch permissions](RELEASING.md#one-time-setup). Each release checks this before publishing. Dispatching starts a publishing run; when required reviewers are configured, the release job waits for approval from a designated maintainer. Run your project's tests and build checks, review the changes, and dispatch from your default branch: Do not merge into the default branch while a release runs; see [recovery](docs/actions/release.md#default-branch-advanced-during-publication).
8080

8181
**First release:** Pass the numeric RubyGems account ID shown on the Pending Trusted Publishers page as `rubygems-owner`. This declares the account that will own the gem on its first publication. Replace `YOUR_ACCOUNT_ID` below with that ID:
8282

‎RELEASING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Builds overwrite local artifacts reproducibly. Capture exports the committer tim
7474

7575
Git reuses matching release and development trees without moving tags or rewinding remote descendants. Development bumps calculate from the supplied release version, so repetition does not increment twice. GitHub replaces differing release metadata, notes read from the changelog, and assets; unspecified platform-generated notes are retained.
7676

77-
Actions preserves `release.gem`, its name/version/digest manifest `release.json`, and `release.bundle` before publication for 30 days. These are for manual inspection, not automatic restoration. Conflicting checksums or tags and unrelated branch advancement require investigation; do not overwrite immutable releases.
77+
Actions preserves `release.gem`, its name/version/digest manifest `release.json`, and `release.bundle` before publication for 30 days. These are for manual inspection, not automatic restoration. Conflicting checksums or tags and unrelated branch advancement require investigation; do not overwrite immutable releases. If the default branch advanced during publication, follow [the manual recovery](docs/actions/release.md#default-branch-advanced-during-publication).
7878

7979
All custom commands and callbacks must be idempotent too. Notifications need receiver-side readback or a stable key such as `"release/example/1.2.3/success"`, never a run ID. They may execute again; without receiver support, exactly-once delivery and automatic detection of an unfinished notification are impossible. Release reconciliation proves package, Git, hosting, and development completion, not arbitrary external callback completion.
8080

‎docs/actions/action.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ For first publication, register a pending trusted publisher and supply its numer
7676

7777
With the sample, dispatch a first release using `gh workflow run release.yml -f rubygems-owner=YOUR_ACCOUNT_ID`, replacing `YOUR_ACCOUNT_ID` with your numeric account ID. For subsequent releases, omit `rubygems-owner`. Validate locally before authorizing publication.
7878

79-
Artifacts must be preserved before publication. Reruns use the supplied checkout and inputs, not restored context or automatically discovered unfinished releases. See [Verify and Recover](../../RELEASING.md#verify-and-recover).
79+
Do not merge into the default branch while a release runs; see [recovery](release.md#default-branch-advanced-during-publication). Artifacts must be preserved before publication. Reruns use the supplied checkout and inputs, not restored context or automatically discovered unfinished releases. See [Verify and Recover](../../RELEASING.md#verify-and-recover).

‎docs/actions/release.md‎

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,46 @@ GitHub also supplies standard variables such as `GITHUB_REPOSITORY` and `RUNNER_
164164

165165
## Recovery Artifacts
166166

167-
The workflow requires `release.gem`, its name/version/digest manifest `release.json`, and `release.bundle` to be uploaded before publication, retained for 30 days under `release-gem-VERSION-RUN_ID-RUN_ATTEMPT`. These support manual inspection, not automatic restoration. See [RELEASING.md](../../RELEASING.md#verify-and-recover).
167+
The workflow requires `release.gem`, its name/version/digest manifest `release.json`, and `release.bundle` to be uploaded before publication, retained for 30 days under `release-gem-VERSION-RUN_ID-RUN_ATTEMPT`. These support manual inspection, not automatic restoration. See [RELEASING.md](../../RELEASING.md#verify-and-recover) and [recovery when the default branch advances during publication](#default-branch-advanced-during-publication).
168168

169169
For already-reviewed commits, stable branches, existing signed tags, and explicitly supplied package collections, use the [reviewed workflow](../workflow/reviewed_ruby_gem.md). It retains publication guards but makes no release preparation commits, new tags, Git pushes, or development bumps. `prepare-artifacts` and `artifacts` support explicit retained inputs without artifact discovery; both interfaces expose the same inputs.
170+
171+
### Default Branch Advanced During Publication
172+
173+
Do not merge into the default branch while a release runs. The tag step fails before publication if the branch has moved since capture, but a merge after that check and before the release push leaves the gem published on RubyGems while the push fails with `Default branch advanced; start a new release`. The release tag, the release commit on the default branch, the GitHub Release, and the next development iteration are then missing. Rerunning does not recover: each run creates a new release commit, and tagging requires the branch to still be at the source commit. Recover manually from the preserved artifacts instead, replacing `1.2.3`, `example`, `RUN_ID`, and `ATTEMPT`:
174+
175+
**Step 1.** Download the failed run's artifacts and confirm RubyGems published the preserved archive:
176+
177+
```sh
178+
gh run download RUN_ID -n release-gem-1.2.3-RUN_ID-ATTEMPT -D release-artifacts
179+
jq -r .sha256 release-artifacts/release.json
180+
curl -s https://rubygems.org/api/v1/versions/example.json | jq -r '.[] | select(.number == "1.2.3") | .sha'
181+
```
182+
183+
The digests must match. If they differ, or the version is missing, stop and investigate instead.
184+
185+
**Step 2.** Import the release commit and tag from the bundle, and push the tag. It points at the release commit, whose parent is the dispatched source commit:
186+
187+
```sh
188+
git fetch release-artifacts/release.bundle 'refs/tags/v1.2.3:refs/tags/v1.2.3'
189+
git push origin refs/tags/v1.2.3
190+
```
191+
192+
**Step 3.** Merge the release commit into the default branch through a pull request, resolving conflicts with the changes merged during the release. Do not rewrite or move the tag.
193+
194+
```sh
195+
git switch -c release-1.2.3 v1.2.3
196+
git push origin release-1.2.3
197+
gh pr create --head release-1.2.3 --title 'Release 1.2.3'
198+
```
199+
200+
**Step 4.** Create the GitHub Release with the preserved archive under its gem file name, as normal releases attach it. Write the released changelog section to `NOTES.md`, or replace `--notes-file NOTES.md` with `--generate-notes`:
201+
202+
```sh
203+
cp release-artifacts/release.gem example-1.2.3.gem
204+
gh release create v1.2.3 --verify-tag --title v1.2.3 --notes-file NOTES.md example-1.2.3.gem
205+
```
206+
207+
**Step 5.** Start the next development iteration in a pull request that increments the version and adds the Next changelog section, as the bump would have.
208+
209+
Do not dispatch a new release of the same version. RubyGems accepts only the identical archive, and a rebuilt release commit would not match the pushed tag.

0 commit comments

Comments
 (0)