From 068b4bc9b9d006f4a202c1ea3ecc0d36c1619338 Mon Sep 17 00:00:00 2001 From: patramsey Date: Wed, 12 Aug 2026 20:49:33 -0600 Subject: [PATCH] ci: publish a Homebrew cask instead of a deprecated formula MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `brews:` has been deprecated for a while. GoReleaser's own description of what it produced is "hackyish formulas that would install the pre-compiled binaries" — a formula is meant to build from source, and this project ships binaries. A cask is the supported shape for that. I nearly did not do this, on the belief that casks are macOS-only and the migration would silently drop the Linux Homebrew support the README advertises. That belief was out of date. Homebrew's Cask#supports_linux? reads: return true if depends_on.requires_linux? !depends_on.requires_macos? so a cask is Linux-capable unless it opts out, and cask/dsl.rb documents per-OS `on_macos`/`on_linux` blocks with their own sha256. GoReleaser's deprecation note said as much ("this was the only way for Linuxbrew at the time, but this is no longer true") and I second-guessed it rather than checking. Verified rather than assumed: a snapshot build writes dist/homebrew/Casks/namecom.rb containing on_linux blocks for both amd64 and arm64, with no `depends_on macos` anywhere — which is exactly the condition supports_linux? tests. Same four platforms as the formula it replaces, same URLs. Ruby syntax checks clean. `goreleaser check` now passes with no deprecation warnings for the first time. That took two steps, not one: `homebrew_casks.binary` is itself deprecated in favour of `binaries`, which the first attempt tripped over. Not done here, because it belongs in the tap repository and is user-facing: tap_migrations.json mapping {"namecom": "namecom"}, plus deleting Formula/namecom.rb. Until both land, an existing `brew install namecom` keeps resolving the stale formula and never sees the cask. The comment in .goreleaser.yaml records this. `brew trust patramsey/tap` in the README stays correct — brew trust covers "tap formulae, casks or commands". --- .goreleaser.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 41edee6..a1b813e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -36,12 +36,26 @@ archives: checksum: name_template: checksums.txt -brews: +# homebrew_casks, not the deprecated `brews`. GoReleaser's formula generator +# produced, in its own words, "hackyish formulas that would install the +# pre-compiled binaries" — a formula is meant to build from source, and this +# project ships binaries. Casks are the supported shape for that now, on Linux +# as well as macOS: a cask is Linux-capable unless it declares `depends_on +# macos` (see Cask#supports_linux? in Homebrew), and the generated cask below +# declares no such dependency. +# +# Migrating renames the published file from Formula/namecom.rb to +# Casks/namecom.rb in the tap. Existing installs need tap_migrations.json in +# the tap repository to follow that rename; without it `brew upgrade` keeps +# resolving the stale formula. See the PR that introduced this. +homebrew_casks: - name: namecom + binaries: + - namecom homepage: https://github.com/patramsey/namecom-cli description: CLI for the name.com domain registrar API license: MIT - directory: Formula + directory: Casks repository: owner: patramsey name: homebrew-tap @@ -49,9 +63,6 @@ brews: commit_author: name: goreleaserbot email: bot@goreleaser.com - install: bin.install "namecom" - test: | - system "#{bin}/namecom", "--version" changelog: sort: asc