feat(ci): automate Homebrew formula updates via GoReleaser#3
Conversation
- add brews configuration to .goreleaser.yml for automatic formula generation - configure formula metadata (description, license, homepage, install, test) - pass HOMEBREW_TAP_TOKEN in release workflow for cross-repo authentication
- update "Run GoReleaser (Release)" condition to include workflow_dispatch with dry_run=false - update "Run GoReleaser (Dry Run)" condition to explicitly check dry_run=true - update "Login to GitHub Container Registry" to also run on manual release dispatch
📝 WalkthroughWalkthroughUpdates CI release workflow and GoReleaser config to add Homebrew formula publishing and to conditionalize release steps for manual dispatches (workflow_dispatch) versus dry-run and tagged pushes; adds HOMEBREW_TAP_TOKEN and adjusts tag detection logic in the release job. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer (push / workflow_dispatch)
participant GH as GitHub Actions
participant Tag as Tag Detector
participant GHCR as GitHub Container Registry
participant GR as GoReleaser
participant Tap as Homebrew Tap (repo)
Dev->>GH: trigger (push tag OR workflow_dispatch OR pull_request)
GH->>Tag: check tag presence / read TAG_NAME
alt workflow_dispatch && dry_run == false
GH->>GHCR: login (condition: dry_run false)
GH->>GR: run GoReleaser (Manual Release) [--snapshot if no tag]
GR->>GHCR: push images/artifacts
GR->>Tap: publish Homebrew formula (uses HOMEBREW_TAP_TOKEN)
else workflow_dispatch && dry_run == true or pull_request
GH->>GR: run GoReleaser (Dry Run)
else push with tag present
GH->>GHCR: login
GH->>GR: run GoReleaser (Release, --clean)
GR->>Tap: publish Homebrew formula (tagged release)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/release.yml:
- Around line 58-67: The release step "Run GoReleaser (Release)" currently runs
goreleaser with args "release --clean" which fails on workflow_dispatch when no
git tag exists; update this step to detect presence of a tag and either append
"--snapshot" to the args when no tag is found or set the environment variable
GORELEASER_CURRENT_TAG to a valid tag string before running goreleaser, or
alternately add "--skip=validate" to the args for intentional tagless releases;
implement the detection as a preceding job or step that exports a boolean (e.g.,
TAG_PRESENT) and then conditionally set args or GORELEASER_CURRENT_TAG in the
Run GoReleaser (Release) step so goreleaser won't error when no tag is present.
- add "Check for Git tag" step to detect tag presence and export TAG_PRESENT output - split release into "Run GoReleaser (Release)" for tag pushes only - add "Run GoReleaser (Manual Release)" for workflow_dispatch with conditional --snapshot - update "Run GoReleaser (Dry Run)" to explicitly check dry_run == true
There was a problem hiding this comment.
Pull request overview
This PR adds automated Homebrew formula publishing to the release process using GoReleaser's built-in brews feature. When new versions are released via Git tags, the Homebrew formula in the l2D/homebrew-tap repository will be automatically updated.
Changes:
- Added Homebrew tap configuration to
.goreleaser.ymlwith automatic formula generation and publishing - Enhanced release workflow to pass
HOMEBREW_TAP_TOKENfor authenticated Homebrew tap updates - Added Git tag detection logic and refined workflow dispatch conditions for non-dry-run manual releases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.goreleaser.yml |
Adds brews section configuring automatic Homebrew formula generation and push to l2D/homebrew-tap |
.github/workflows/release.yml |
Adds tag detection step, passes HOMEBREW_TAP_TOKEN to release steps, and refines conditions for manual workflow dispatch with dry_run=false |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Automate Homebrew formula updates when releasing new versions using GoReleaser's built-in
brewsfeature.Changes
brewsconfiguration to.goreleaser.ymlfor automatic formula generation and push tol2D/homebrew-tapHOMEBREW_TAP_TOKENenvironment variable in release workflowdry_run=falseto run actual releasesRequired Setup
Before merging, add the
HOMEBREW_TAP_TOKENsecret to this repository:Contents: Read and writeaccess tol2D/homebrew-tapHOMEBREW_TAP_TOKENSummary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.