Skip to content

ci: migrate the Homebrew tap from a formula to a cask - #116

Merged
sergiught merged 2 commits into
mainfrom
ci/migrate-homebrew-casks
Aug 3, 2026
Merged

ci: migrate the Homebrew tap from a formula to a cask#116
sergiught merged 2 commits into
mainfrom
ci/migrate-homebrew-casks

Conversation

@sergiught

Copy link
Copy Markdown
Owner

📝 Summary

goreleaser check fails on our config with DEPRECATED: brews should not be used anymore — note the stronger wording than the dockers notice in #115: this one is "should not be used", not "being phased out".

The reason is Homebrew's own taxonomy, not a goreleaser preference. From Acceptable-Casks.md:

Casks distribute applications and other pre-built files published by the upstream developer.
Open-source command-line-only software normally belongs in homebrew/core as a formula built from source.

Our brews block only ever emitted a formula that downloads the prebuilt release tarball and copies the binary out — a cask wearing a formula's clothes. homebrew_casks puts it on the right side of that line.

Secondary win: the hand-written extra_install Ruby is replaced by declarative completions:/manpages: fields, and the man/*.1 glob expands to all 53 generated pages by itself.

🔄 Existing users migrate automatically

This PR also ships packaging/homebrew-tap/tap_migrations.json. Homebrew's update reporter has a dedicated same-tap formula→cask path — Library/Homebrew/cmd/update_report/reporter.rb, in migrate_tap_migration:

if new_tap.core_cask_tap? || new_tap.cask_tokens.intersect?([new_full_name, new_name])
  migration_message = if new_tap == tap
    "#{full_name} has been migrated from a formula to a cask."

When it fires, brew update runs brew unlink ofga, brew cleanup, then brew install --cask sergiught/tap/ofga, and tells the user to brew uninstall --formula --force ofga at their convenience. {"ofga": "ofga"} is the mapping that resolves to the fully-qualified cask token (tracing the name-resolution branches in that same method).

Without this file, existing installs would keep a formula that stops receiving updates, silently. With it, no user action is required and no reinstall instructions are needed.

🚚 Merge steps in the tap repo

This PR cannot complete the migration on its own — sergiught/homebrew-tap needs two manual changes, ideally in the same commit, timed with the first release on this config:

  1. Add tap_migrations.json (copy from packaging/homebrew-tap/tap_migrations.json).
  2. Delete Formula/ofga.rb. goreleaser writes Casks/ofga.rb but will not remove the old formula. If it stays, the tap carries a stale formula pinned at 0.267.0 alongside the cask.

📥 How users install

Unchanged — brew install accepts formula|cask, so the documented command still resolves:

brew install sergiught/tap/ofga

brew upgrade ofga and brew uninstall ofga also work on casks (brew upgrade is documented over installed_formula | installed_cask). No docs changes needed to README.md:100 or docs/site/src/content/docs/guide/installation.mdx.

Casks support Linux — Homebrew's Cask Cookbook documents on_linux and depends_on :linux — so no platform coverage is lost. The generated cask carries all four macOS/Linux × intel/arm combinations.

🏷 Type of change

  • 🐛 Bug fix (non-breaking)
  • ✨ Feature (non-breaking)
  • 💥 Breaking change (users must update)
  • ♻️ Refactor (no functional change)
  • 📚 Docs only
  • 🛠 Build / CI / tooling

✅ How to verify

goreleaser check   # brews deprecation gone
goreleaser release --snapshot --clean --skip=sbom,nfpm,aur,sign,docker
cat dist/homebrew/Casks/ofga.rb

Generated locally with goreleaser v2.17.0 — abridged:

cask "ofga" do
  on_macos do
    on_intel do  sha256 "f4a92a17…"  url "…/ofga_Darwin_x86_64.tar.gz"  end
    on_arm   do  sha256 "9fac3276…"  url "…/ofga_Darwin_arm64.tar.gz"   end
  end
  on_linux do
    on_intel do  sha256 "4e0140aa…"  url "…/ofga_Linux_x86_64.tar.gz"   end
    on_arm   do  sha256 "b435c0a8…"  url "…/ofga_Linux_arm64.tar.gz"    end
  end
  binary "ofga"
  manpage "man/ofga-api.1"   # …53 manpage lines, expanded from the glob…
  bash_completion "completions/ofga.bash"
  fish_completion "completions/ofga.fish"
  zsh_completion  "completions/ofga.zsh"
  postflight do
    if OS.mac?
      system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/ofga"]
    end
  end
end

The postflight hook is required because our darwin binaries aren't notarized and Homebrew quarantines cask downloads — without it macOS Gatekeeper blocks the binary on first run.

Not verified on a Mac. The cask generation, config validation and Homebrew behaviour above are all read from generated output and Homebrew's source; I have no macOS/brew available. Worth one brew install sergiught/tap/ofga on a Mac after the first release on this config, and confirming an existing formula install migrates on brew update.

📋 Checklist

  • 🧪 Tests added or updated where it makes sense — n/a, build config; verified by generating the cask
  • 📖 Docs updated — packaging/README.md now points at Casks/ofga.rb and the new migrations file; user-facing install docs need no change
  • 🏷 PR title follows Conventional Commits
  • 🟢 make check passes locally — n/a, no Go code touched

goreleaser reports 'brews should not be used anymore'. Homebrew's own
policy draws the line by artifact type: casks distribute pre-built files
published by the developer, while formulae are built from source. The
brews block only ever emitted a formula that downloads our prebuilt
tarball and copies the binary out, which is cask territory.

homebrew_casks also replaces the hand-written extra_install Ruby with
declarative completions/manpages fields, and the man/*.1 glob expands to
all 53 generated pages on its own.

Ship tap_migrations.json alongside it. Homebrew's update reporter has a
dedicated same-tap formula-to-cask branch (new_tap == tap in
migrate_tap_migration), so existing installs migrate automatically on
brew update rather than silently going stale.

The darwin binaries are not notarized and Homebrew quarantines cask
downloads, so a postflight hook clears com.apple.quarantine.
@sergiught
sergiught force-pushed the ci/migrate-homebrew-casks branch from e445eb9 to 4cfc456 Compare August 3, 2026 09:47
@sergiught
sergiught merged commit ad24fc0 into main Aug 3, 2026
7 checks passed
@sergiught
sergiught deleted the ci/migrate-homebrew-casks branch August 3, 2026 09:53
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