Repository navigation
build: ship the Homebrew formula as a source build with bottles - #231
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the
pre-commitformula from GoReleaser's deprecatedbrewstohomebrew_bottles, the same conversion as blairham/k4a#178.What changes
.goreleaser.yaml:brewsbecomeshomebrew_bottles, bottling only thepre-commitbuild (ids). The oldinstall: bin.install "pre-commit"is removed: inhomebrew_bottles,installis the build-from-source step and the pipe generates it from the build (main., ldflags,CGO_ENABLED=0, plusdepends_on "go" => :build).directory: Formulais dropped as the default.source: enabled: trueproduces the tarball the formula'surlpoints at.blairham/.githubpin moves to v0.0.4 (ed30c15), andrelease.ymlpassesgoreleaser-ref: 6b2bad9d…, sogo-release.ymlbuilds and runs blairham/goreleaser. Official GoReleaser rejects a config containinghomebrew_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, sorelease.ymlis the only caller that needs the input.goreleaserfrom.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, aninstallthatgo builds the binary, and abottle doblock pouring bottles made from the release's darwin and linux binaries. A normalbrew installstill downloads a binary, andbrew install -sbuilds from source.Verified locally (fork build of 6b2bad9d, snapshot)
goreleaser checkpasses.release --snapshot --skip=publish,sign,docker,notarizewrites a formula with a sourceurl,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 onlypre-commit/<version>/bin/pre-commit.No release is cut by this PR.