Skip to content

ci(release): auto-bump homebrew-tap after release#63

Merged
vxcozy merged 2 commits into
mainfrom
ci/auto-bump-homebrew-tap
Apr 19, 2026
Merged

ci(release): auto-bump homebrew-tap after release#63
vxcozy merged 2 commits into
mainfrom
ci/auto-bump-homebrew-tap

Conversation

@vxcozy
Copy link
Copy Markdown
Owner

@vxcozy vxcozy commented Apr 19, 2026

Summary

Two-commit PR:

  1. ci(release): auto-bump homebrew-tap after release — adds a homebrew-tap job that, after the build matrix and release step succeed, checks out vxcozy/homebrew-tap, downloads the release assets, computes sha256s, rewrites Formula/clitunes.rb, and pushes the bump commit on main.
  2. ci(release): workflow_dispatch entry for tap-bump validation — adds a manual trigger (with target_tag + dry_run inputs, dry_run default true) so the tap-bump logic can be validated against an existing tag without cutting a new release. build and release jobs skip on workflow_dispatch; only the tap-bump job runs.

Closes clitunes-7ch / CLI-95.

Why

v1.2.0 shipped but brew upgrade clitunes was a no-op for ~15 minutes because the tap was still pointing at v1.1.0. A human had to clone the tap, fetch 4 tarballs, recompute 4 sha256s, rewrite URLs + checksums, and push. This PR automates that procedure.

Option (c) from the plan: a small bash + python step on a first-party actions/checkout. No third-party actions, easy to audit.

The second commit exists because the -rc skip (commit 1) means RC dry runs can't validate the tap-bump job itself — it would skip itself. workflow_dispatch closes that gap: run the job manually against an already-released tag to prove the regex + download + rewrite path works end-to-end, with dry_run=true by default so nothing is ever pushed to the tap accidentally.

Behaviour

  • On tag push (non-rc): needs: [build, release] — runs only after the tag's release is live on GitHub. -rcN tags are skipped so the stable tap never tracks a release candidate.
  • On workflow_dispatch: build and release are skipped. homebrew-tap runs against inputs.target_tag. dry_run=true (default) stops before the git push; dry_run=false actually commits.
  • 5x linear-backoff retry on each tarball download (release asset CDN sometimes lags the release job completion by a few seconds).
  • Per-target regex rewrite with a n != 1 guard — formula shape change would fail the job loudly rather than silently pushing an untouched commit.
  • always() on the if: expression so the explicit success check on needs.{build,release} runs instead of GitHub short-circuiting to "skip on needs-skipped".
  • Commits as github-actions[bot].

Secret provisioning (required before the next tag push)

Create a fine-grained PAT at https://github.com/settings/personal-access-tokens/new:

  • Resource owner: vxcozy
  • Repository access: Only select repositories → vxcozy/homebrew-tap
  • Permissions → Repository permissions → Contents: Read and write (Metadata auto-added as Read-only)

Add to vxcozy/clitunes → Settings → Secrets and variables → Actions → New repository secret: HOMEBREW_TAP_TOKEN.

Without the secret, the checkout step fails at the first tag push — safe failure mode, no partial state.

Test plan

  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --all-features
  • YAML syntax-check via ruby YAML.load_file
  • Regex dry-run against the current vxcozy/homebrew-tap formula — all 4 URL/sha pairs matched exactly once
  • After merge + secret provisioning: trigger workflow_dispatch with target_tag=v1.2.0, dry_run=true. "Show diff" step should log a no-op diff (tap already points at v1.2.0 after tonight's manual bump). If the diff is clean, the whole tap-bump pipeline is validated and we can trust the next real release.

Adds a new `homebrew-tap` job to release.yml that, after both the build
matrix and the GitHub release step succeed, checks out vxcozy/homebrew-tap,
downloads the 4 freshly-cut release assets, computes sha256 for each,
rewrites Formula/clitunes.rb with the new URLs + checksums, and pushes the
bump commit on main. Eliminates the manual ~15 minute window between a tag
push and `brew upgrade clitunes` actually picking up the new version.

Shape:
- needs: [build, release] — fires only when the release is already live
- if: !contains(github.ref_name, '-rc') — the stable tap skips -rcN tags
- curl download has a 5x linear-backoff retry loop to tolerate a small lag
  between the release job finishing and the asset CDN propagating
- python3 in-place rewrite with a per-target regex; guard fails the job
  loudly if any arch doesn't match exactly once (no silent no-op push)
- author is github-actions[bot] so tap history shows automated commits

Required before the next release: create a fine-grained PAT with
Contents: Read & Write on vxcozy/homebrew-tap and register it as the
HOMEBREW_TAP_TOKEN secret on vxcozy/clitunes. Without the secret the
checkout step fails loudly on the first run — failure mode is safe.

Closes clitunes-7ch / CLI-95
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Lets us validate the homebrew-tap job against an existing release
(e.g. v1.2.0) without cutting a new tag. `dry_run` defaults to true
so a manual run is never load-bearing by accident; setting it false
actually pushes to the tap.

build + release now skip on workflow_dispatch (they'd re-publish
artifacts that already exist); only the tap-bump job runs.
@vxcozy vxcozy merged commit 89ad3b9 into main Apr 19, 2026
12 checks passed
@vxcozy vxcozy deleted the ci/auto-bump-homebrew-tap branch April 19, 2026 04:20
vxcozy added a commit that referenced this pull request Apr 19, 2026
Patch release: sakura + heartbeat AGC fixes, firework removal,
release.yml auto-bumps the Homebrew tap.

First tag after release.yml changed in PR #63 — must be cut as
v1.2.1-rc1 first to exercise the full tag-push pipeline (build ×4,
release, and the new homebrew-tap job) before cutting v1.2.1.

Closes CLI-97 (viz AGC), CLI-95 (tap automation) on the release side.
@vxcozy vxcozy mentioned this pull request Apr 19, 2026
6 tasks
vxcozy added a commit that referenced this pull request Apr 19, 2026
Patch release: sakura + heartbeat AGC fixes, firework removal,
release.yml auto-bumps the Homebrew tap.

First tag after release.yml changed in PR #63 — must be cut as
v1.2.1-rc1 first to exercise the full tag-push pipeline (build ×4,
release, and the new homebrew-tap job) before cutting v1.2.1.

Closes CLI-97 (viz AGC), CLI-95 (tap automation) on the release side.
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.

1 participant