Skip to content

ci: publish a Homebrew cask instead of a deprecated formula - #36

Merged
patramsey merged 1 commit into
mainfrom
ci/homebrew-cask
Aug 18, 2026
Merged

ci: publish a Homebrew cask instead of a deprecated formula#36
patramsey merged 1 commit into
mainfrom
ci/homebrew-cask

Conversation

@patramsey

Copy link
Copy Markdown
Owner

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.

I nearly didn't do this, and my reason was wrong

I argued against migrating on the belief that casks are macOS-only, so it would silently drop the Linux Homebrew support the README advertises. That belief is out of date. From Homebrew's source on this machine:

# cask/cask.rb:260
def supports_linux?
  return true if depends_on.requires_linux?
  !depends_on.requires_macos?     # ← Linux-capable unless it opts out
end

cask/dsl.rb documents per-OS on_macos/on_linux blocks with their own sha256, and installer.rb has a "This cask requires Linux." path. GoReleaser's deprecation note said exactly this — "this was the only way for Linuxbrew at the time, but this is no longer true" — and I second-guessed it instead of checking.

Verified, not assumed

A snapshot build writes dist/homebrew/Casks/namecom.rb containing:

on_linux do
  on_intel do
    url ".../namecom_linux_amd64.tar.gz"
  end
  on_arm do
    url ".../namecom_linux_arm64.tar.gz"
  end
end

No depends_on macos anywhere — which is precisely the condition supports_linux? tests. Same four platforms as the formula it replaces, same URLs. ruby -c on the generated file: Syntax OK.

goreleaser check is clean for the first time

That took two steps, not one: homebrew_casks.binary is itself deprecated in favour of binaries, which my first attempt tripped over. Now:

• 1 configuration file(s) validated

No deprecation warnings.

⚠️ This PR alone does not complete the migration

Two changes belong in patramsey/homebrew-tap, not here, and they're user-facing:

  1. Add tap_migrations.json at the tap root:
    { "namecom": "namecom" }
  2. Delete Formula/namecom.rb

Until both land, an existing brew install namecom keeps resolving the stale formula and never sees the cask. The migrations file is what makes brew upgrade follow the rename. I haven't touched the tap — that's a separate repo and affects anyone who has already installed, so it's your call when.

Sequencing that avoids a gap: merge this, then make the tap changes, then the next release publishes Casks/namecom.rb and existing users migrate on their next brew upgrade.

brew trust patramsey/tap in the README stays correct — brew trust covers "tap formulae, casks or commands".

Test plan

  • goreleaser check — validates with zero deprecation warnings
  • goreleaser release --snapshot --clean — cask generated successfully
  • Generated cask contains on_linux blocks for amd64 and arm64
  • Generated cask has no depends_on macos (the thing supports_linux? keys off)
  • ruby -c on the generated cask: Syntax OK
  • brew trust confirmed to be a real command covering casks
  • Not verifiable until the next tag — release.yml only runs on tags

`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".
@patramsey
patramsey merged commit 70571c8 into main Aug 18, 2026
4 checks passed
@patramsey
patramsey deleted the ci/homebrew-cask branch August 18, 2026 02:32
patramsey added a commit that referenced this pull request Aug 18, 2026
Two user-facing changes since v0.2.3.

The Go toolchain moves to 1.26.6, clearing four standard-library
advisories govulncheck found reachable from this binary. The v0.2.3
binaries were built with 1.26.5 and carry all four, so this release is
the only thing that gets the fix to anyone who has already installed --
a green CI job does nothing for them.

Homebrew switches from a formula to a cask, which #36 configured but no
release has exercised yet. That change is user-facing and was missing
from the changelog, so it is recorded here rather than left to whoever
wonders why their install method changed.

This release is also time-sensitive. The tap has already dropped
Formula/namecom.rb and added its migration entry, so until goreleaser
publishes Casks/namecom.rb there is no namecom in the tap at all: a
fresh `brew install namecom` finds nothing, and an installed user who
runs `brew update` in this window spends their one-shot migration while
cask_tokens is still empty. Tagging closes it.
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