Skip to content

Conversation

@l2D
Copy link
Owner

@l2D l2D commented Jan 28, 2026

Summary

Automate Homebrew formula updates when releasing new versions using GoReleaser's built-in brews feature.

Changes

  • Add brews configuration to .goreleaser.yml for automatic formula generation and push to l2D/homebrew-tap
  • Pass HOMEBREW_TAP_TOKEN environment variable in release workflow
  • Fix workflow conditions to allow manual dispatch with dry_run=false to run actual releases

Required Setup

Before merging, add the HOMEBREW_TAP_TOKEN secret to this repository:

  1. Create a GitHub PAT with Contents: Read and write access to l2D/homebrew-tap
  2. Add it as a repository secret named HOMEBREW_TAP_TOKEN

Summary by CodeRabbit

  • New Features

    • Publish a Homebrew formula for easy installation via Homebrew.
  • Chores

    • Enhanced release workflow: added manual release support, dry-run vs manual dispatch handling, snapshot mode when no tag, expanded registry login triggers, and added environment tokens for releases.

✏️ Tip: You can customize this high-level summary in your review settings.

l2D added 2 commits January 29, 2026 01:14
- 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
@l2D l2D self-assigned this Jan 28, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Updates 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

Cohort / File(s) Change Summary
Release workflow
\.github/workflows/release\.yml
Added a step to detect tag presence/name and output TAG_PRESENT/TAG_NAME; expanded conditions to allow login to GHCR and release steps on workflow_dispatch when dry_run is false; added HOMEBREW_TAP_TOKEN to release env; split GoReleaser runs into Manual Release (dispatch, non-dry-run), Dry Run (dispatch with dry_run true + pull_request), and Tagged Release (push-to-tag) flows.
GoReleaser configuration
\.goreleaser\.yml
Added a brews section to publish a Homebrew formula: tap owner/name/token, formula directory, homepage/description/license, install/test hooks, and commit message template.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through tags and dispatch lights,
Pushed bottles, formulas, and nightly rites.
A token tucked, GoReleaser hums,
Homebrew sips where azswitch comes.
Cheers — the rabbit taps the drums 🎶

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ci): automate Homebrew formula updates via GoReleaser' directly and accurately summarizes the main change: automating Homebrew formula updates using GoReleaser's brews feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

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

Copy link

@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

🤖 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
Copilot AI review requested due to automatic review settings January 28, 2026 18:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.yml with automatic formula generation and publishing
  • Enhanced release workflow to pass HOMEBREW_TAP_TOKEN for 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.

@l2D l2D merged commit a28a641 into main Jan 28, 2026
19 checks passed
@l2D l2D deleted the feat/automate-homebrew-formula-update branch January 28, 2026 18:37
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