Skip to content

Stop bumping the version in release.yml — read it, never write it - #26

Merged
Marcogn merged 2 commits into
mainfrom
claude/release-docs-automation-5c649r
Aug 17, 2026
Merged

Stop bumping the version in release.yml — read it, never write it#26
Marcogn merged 2 commits into
mainfrom
claude/release-docs-automation-5c649r

Conversation

@Marcogn

@Marcogn Marcogn commented Aug 17, 2026

Copy link
Copy Markdown
Owner

What changed (updated — see below for how this PR evolved)

Current state: release.yml no longer writes the release version anywhere. It reads package.json's "version" field directly, refuses to run if a GitHub Release for that version already exists, and otherwise builds/publishes exactly as before. Bumping the version is now an ordinary, human-reviewed PR like any other change to this repo (bump package.json, add the matching CHANGELOG.md entry, merge it) — release.yml never touches main, so it never runs into branch protection at all.

How this PR got here

  1. First commit: fixed the "Decode release keystore" step to fail with an actionable error instead of a bare base64: invalid input (the actual first failure hit in production — the ANDROID_KEYSTORE_BASE64 secret's stored value wasn't valid base64).
  2. Second commit: the next real run got past the Android build but failed pushing the version bump straight to main (GH006: Protected branch update failed, "Require a pull request before merging"). Fixed by having release.yml open and auto-merge a small chore(release): vX.Y.Z PR instead of pushing directly.
  3. This commit: that PR-based approach worked, but compared against a sibling project — ThePatientGamerHelper, which has the same kind of branch protection on main and an already-working release.yml — showed a simpler fix. That workflow never bumps its own version; it only reads versionName from an already-merged build.gradle.kts and refuses to overwrite an existing release. Applied the same pattern here: release.yml no longer needs pull-requests: write, doesn't depend on "Allow auto-merge" being enabled, and never has to deal with branch protection because it never writes to the protected branch in the first place.

Why

Per your report that release kept failing on "something else" each time — each commit in this PR fixes the specific next thing that broke on a real run against 1.0.0, ending with a fundamentally simpler design (read-only version) instead of working around branch protection with increasingly more moving parts.

Test plan

  • All three workflow YAML files parse successfully with yaml.safe_load.
  • Every run: step in the final release.yml checked individually with bash -n (syntax only).
  • Re-verified the sed version-sync commands against the real android/app/build.gradle locally (correct versionCode/versionName output, file left unchanged afterward — this step never commits).
  • npm run test — unaffected, still 175 passing (workflow/docs-only change).

Next step (for you, not this PR)

package.json's "version" is already 1.0.0 on main, and CHANGELOG.md already has its [1.0.0] entry — nothing to bump for the first release. Re-run the Release workflow once more; it should now get all the way through.

claude added 2 commits August 17, 2026 11:06
…to main

The second real Release run got past the (now-fixed) keystore issue but
failed at "Commit version bump" with GH006: Protected branch update
failed for refs/heads/main — main requires pull requests, and the
workflow's default GITHUB_TOKEN has no bypass for that (unlike the repo
owner merging PRs by hand). Confirmed there's no ruleset and no "Lock
branch" rule involved, just "Require a pull request before merging".

release.yml now opens a small chore(release): vX.Y.Z branch/PR against
main and merges it (approve + squash --auto) using the workflow's own
token, instead of pushing directly — no branch-protection bypass or PAT
needed, just the "Allow GitHub Actions to create and approve pull
requests" repo setting that's already been turned on. If the merge can't
be automated (e.g. repo-wide auto-merge is off, or required checks are
still pending), the step only warns and moves on: the GitHub Release,
APK, and Pages deploy don't depend on the PR having landed, only on the
build already on disk.

Documented the mechanism and the two repo settings it relies on in
docs/android/BUILD.md, and updated the STATUS.md loose end to reflect
both real failures hit so far and their fixes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WH1WrPxkRsDyMo76MPn3Us
The PR-based version bump from the previous commit worked but was more
machinery than the problem needed: pull-requests: write, two extra repo
settings (Allow GitHub Actions to create and approve pull requests,
Allow auto-merge), and a non-fatal fallback for when those aren't
configured just right.

Comparing against github.com/Marcogn/ThePatientGamerHelper's release.yml
— a sibling project's already-working release pipeline, with the same
kind of branch protection on main — showed a simpler fix: that workflow
never bumps anything, it only reads versionName from an already-merged
build.gradle.kts and refuses to overwrite an existing release. Applied
the same pattern here.

release.yml now reads package.json's "version" directly (no workflow
input anymore) and fails outright if a GitHub Release for that version
already exists, instead of silently no-op'ing. Bumping the version is
now an entirely normal, human-reviewed PR like any other change — the
release workflow only ever reads what's already on main, so it never
touches branch protection at all, and pull-requests: write is dropped
from its permissions. Android's versionName/versionCode are still
patched from the same version, just locally in the build checkout,
never committed.

Updated CLAUDE.md, docs/DEVELOPMENT.md, docs/android/BUILD.md, and
docs/STATUS.md to match — including that "trigger release.yml as a
Pages-only redeploy trick" no longer works now that it refuses to run
for an already-released version (use the manual deploy steps instead).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WH1WrPxkRsDyMo76MPn3Us
@Marcogn Marcogn changed the title Route the release version bump through a PR instead of a direct push to main Stop bumping the version in release.yml — read it, never write it Aug 17, 2026
@Marcogn
Marcogn marked this pull request as ready for review August 17, 2026 11:20
@Marcogn
Marcogn merged commit 81f6b36 into main Aug 17, 2026
2 checks passed
@Marcogn
Marcogn deleted the claude/release-docs-automation-5c649r branch August 17, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants