Skip to content

build: ship the Homebrew formula as a source build with bottles - #231

Merged
blairham merged 1 commit into
mainfrom
homebrew-bottles
Nov 23, 2026
Merged

blairham merged 1 commit into
mainfrom
homebrew-bottles

Conversation

@blairham

Copy link
Copy Markdown
Owner

Moves the pre-commit formula from GoReleaser's deprecated brews to homebrew_bottles, the same conversion as blairham/k4a#178.

What changes

  • .goreleaser.yaml: brews becomes homebrew_bottles, bottling only the pre-commit build (ids). The old install: bin.install "pre-commit" is removed: in homebrew_bottles, install is the build-from-source step and the pipe generates it from the build (main ., ldflags, CGO_ENABLED=0, plus depends_on "go" => :build). directory: Formula is dropped as the default. source: enabled: true produces the tarball the formula's url points at.
  • Workflows: every blairham/.github pin moves to v0.0.4 (ed30c15), and release.yml passes goreleaser-ref: 6b2bad9d…, so go-release.yml builds and runs blairham/goreleaser. Official GoReleaser rejects a config containing homebrew_bottles (proposed upstream as feat(homebrew_bottles): add a formula publisher that pours bottles and builds from source goreleaser/goreleaser#7342). No CI job here runs GoReleaser, so release.yml is the only caller that needs the input.
  • AGENTS.md: describes the formula, and notes that a local goreleaser from .tool-versions (official 2.15.3) will no longer parse this config.

Why

The old formula only unpacked a prebuilt archive. The new one is shaped like a homebrew-core CLI: a source url, an install that go builds the binary, and a bottle do block pouring bottles made from the release's darwin and linux binaries. A normal brew install still downloads a binary, and brew install -s builds from source.

Verified locally (fork build of 6b2bad9d, snapshot)

goreleaser check passes. release --snapshot --skip=publish,sign,docker,notarize writes a formula with a source url, depends_on "go" => :build, system "go", "build", *std_go_args(ldflags: "...", output: bin/"pre-commit"), ".", and a bottle block with four tags (arm64_monterey, monterey, arm64_linux, x86_64_linux). Each bottle contains only pre-commit/<version>/bin/pre-commit.

No release is cut by this PR.

GoReleaser has deprecated `brews`, and the formula it wrote only unpacked a
prebuilt archive with `bin.install`. homebrew_bottles writes the formula the
way homebrew-core ships a CLI instead: its url is the release's source
archive, its install `go build`s the pre-commit binary with the release's
main package, ldflags and CGO_ENABLED=0, and a bottle block pours bottles made
from the release's darwin and linux binaries, so a normal install still
downloads a binary while `brew install -s` builds from source.

The publisher exists only in blairham/goreleaser (proposed upstream as
goreleaser/goreleaser#7342), and official GoReleaser rejects a config that
names it. release.yml therefore passes goreleaser-ref, the input
blairham/.github added in v0.0.4, to run the fork; every shared-workflow pin
moves to v0.0.4 together. The old `install` is gone because here it would be
the source-build step, and `source` is enabled to produce the archive the
formula's url points at.
@blairham
blairham merged commit 9e4b727 into main Nov 23, 2026
16 checks passed
@blairham
blairham deleted the homebrew-bottles branch November 23, 2026 15:46
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