Skip to content

ci(release): bump homebrew-tap formula on readie publish#6

Open
BurnedChris wants to merge 1 commit into
mainfrom
chore/add-homebrew-tap-bumper
Open

ci(release): bump homebrew-tap formula on readie publish#6
BurnedChris wants to merge 1 commit into
mainfrom
chore/add-homebrew-tap-bumper

Conversation

@BurnedChris
Copy link
Copy Markdown
Contributor

Summary

Adds a bump-homebrew-tap job to .github/workflows/release.yml. It runs after the release job on main and, if readie is in publishedPackages:

  1. Downloads https://registry.npmjs.org/readie/-/readie-<version>.tgz (with retry while the registry catches up).
  2. Computes its sha256.
  3. Opens a PR against inthhq/homebrew-tap updating Formula/readie.rb's url and sha256 to the new version.

Tap CI then runs brew audit --strict --online and brew test readie against the change before the PR can be merged. The companion PR adding Formula/readie.rb to the tap is inthhq/homebrew-tap#2.

The release job's outputs block was added so the new job can read publishedPackages.

Required secret

Before merging, add a repo secret named TAP_GITHUB_TOKEN:

  • Fine-grained PAT scoped to inthhq/homebrew-tap
  • Permissions: Contents: write, Pull requests: write

The default GITHUB_TOKEN cannot push to another repository, which is why a dedicated PAT is required.

Test plan

  • Add TAP_GITHUB_TOKEN to repo secrets.
  • Merge inthhq/homebrew-tap#2 first so Formula/readie.rb exists.
  • Land a changeset that publishes readie and confirm a bump PR appears at inthhq/homebrew-tap with the correct url + sha256.
  • Confirm tap CI (brew install, brew test, brew audit --strict --online) passes against the bump PR.

Made with Cursor

Adds a `bump-homebrew-tap` job to the release workflow that fires after
a successful npm publish on `main`. When `readie` is in
`publishedPackages`, it downloads the new tarball from
`registry.npmjs.org`, computes its sha256, and opens a PR against
`inthhq/homebrew-tap` updating `Formula/readie.rb`'s `url` and `sha256`.

Tap CI then runs `brew audit --strict --online` and `brew test readie`
against the change before the PR can be merged.

Requires repo secret TAP_GITHUB_TOKEN: a fine-grained PAT scoped to
inthhq/homebrew-tap with Contents: write and Pull requests: write
(GITHUB_TOKEN cannot push to another repository).

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Enhanced release automation to automatically synchronize the Homebrew formula with newly published versions, including version updates and checksums, streamlining the release process.

Walkthrough

The release workflow gains the ability to automatically synchronize published versions to the Homebrew formula repository. The release job now exports publication status and package list as outputs. A new downstream job, conditioned on successful publishing, extracts the released version, waits for npm tarball availability, computes its SHA-256, and updates the inthhq/homebrew-tap formula with the new URL and checksum before opening a pull request.

Changes

Homebrew Release Workflow

Layer / File(s) Summary
Release Job Outputs
.github/workflows/release.yml
Release job exposes published and publishedPackages outputs from the Changesets step for downstream job conditions.
Homebrew Formula Auto-Bump Job
.github/workflows/release.yml
New bump-homebrew-tap job runs when release publishes; extracts version, waits for npm tarball availability, computes SHA-256, updates Formula/readie.rb, and opens an automated PR.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A workflow now hops with newfound grace,
Publishing wields a second face—
Homebrew taps shall dance and gleam,
SHA-256 checksums fulfill the dream!
One release, two jobs in harmony,
Automation blooming wild and free. 🍺

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: adding automation to bump the Homebrew formula when readie is published.
Description check ✅ Passed The description is directly related to the changeset, providing detailed context about the new bump-homebrew-tap job, its functionality, required setup, and testing plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-homebrew-tap-bumper

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 140-141: The current .replace chain uses
.replace(/^(\s*sha256\s+).*$/m, ...) which can modify the first sha256 anywhere
in the file; change the second replace so it only targets the sha256 inside the
formula's source stanza instead of the first sha256 in the file. Concretely,
modify the .replace call that currently matches /^(\s*sha256\s+).*$/m (the
second replace in the chain that follows .replace(/^(\s*url\s+).*$/m,...)) to
first locate the "source" block and then replace the sha256 only within that
block (e.g., match the source stanza and replace the sha256 line inside it),
ensuring bottle checksums earlier in the file are not touched.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2b97a0d0-d1e3-4b00-96e3-c62204abf4e3

📥 Commits

Reviewing files that changed from the base of the PR and between 7040e0a and 4c3bdb5.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
📜 Review details
🔇 Additional comments (2)
.github/workflows/release.yml (2)

61-75: Good output wiring and downstream gating.

Exposing published/publishedPackages and gating the follow-up job on publish state is clean and avoids unnecessary tap updates.


98-117: Retry/backoff strategy for npm propagation looks solid.

The bounded retry loop with connect/max-time limits is a good reliability guard for registry lag.

Comment on lines +140 to +141
.replace(/^(\s*url\s+).*$/m, `$1"${process.env.URL}"`)
.replace(/^(\s*sha256\s+).*$/m, `$1"${process.env.SHA}"`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Scope the checksum replacement to the source stanza (not first sha256).

On Line 141, ^(\s*sha256\s+).*$/m mutates the first sha256 in the file. If the formula later includes bottle checksums earlier, this can update the wrong field and produce a broken bump PR.

Suggested fix
-            const next = src
-              .replace(/^(\s*url\s+).*$/m, `$1"${process.env.URL}"`)
-              .replace(/^(\s*sha256\s+).*$/m, `$1"${process.env.SHA}"`);
+            const next = src.replace(
+              /(^\s*url\s+)"[^"]+"(\n\s*sha256\s+)"[^"]+"/m,
+              `$1"${process.env.URL}"$2"${process.env.SHA}"`
+            );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 140 - 141, The current .replace
chain uses .replace(/^(\s*sha256\s+).*$/m, ...) which can modify the first
sha256 anywhere in the file; change the second replace so it only targets the
sha256 inside the formula's source stanza instead of the first sha256 in the
file. Concretely, modify the .replace call that currently matches
/^(\s*sha256\s+).*$/m (the second replace in the chain that follows
.replace(/^(\s*url\s+).*$/m,...)) to first locate the "source" block and then
replace the sha256 only within that block (e.g., match the source stanza and
replace the sha256 line inside it), ensuring bottle checksums earlier in the
file are not touched.

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