Skip to content

feat: publish the Homebrew cask from GoReleaser - #16

Merged
KristofferRisa merged 1 commit into
mainfrom
feat/homebrew-goreleaser
Aug 26, 2026
Merged

feat: publish the Homebrew cask from GoReleaser#16
KristofferRisa merged 1 commit into
mainfrom
feat/homebrew-goreleaser

Conversation

@KristofferRisa

Copy link
Copy Markdown
Owner

Closes the automation half of #14 (tasks 2 and 3; task 1 was already done by hand).

Why

The tap lives in KristofferRisa/homebrew-powerctl — that part is a real Homebrew requirement, since brew tap kristofferrisa/powerctl only resolves to a repo named homebrew-*. It can't be merged into this repo without users having to pass a git URL on every tap.

But the separate repo isn't what's actually costing anything. The cost is that the tap carries a 150-line workflow that curls each archive, sha256s it, and rewrites the formula from a heredoc — and the repository_dispatch that was supposed to trigger it was never added here. Every formula bump so far ran as a manual workflow_dispatch.

GoReleaser already builds those archives and already knows their checksums. Letting it write the tap turns the tap into generated output nobody edits, which removes the manual step and keeps the conventional install line.

What changed

  • homebrew_casks block targeting the tap, authenticating with the HOMEBREW_TAP_TOKEN secret that already existed in this repo but was never wired to anything.
    • Casks, not brews: brews is hard-deprecated as of GoReleaser v2.16, and release.yml pins version: "~> v2", which floats to v2.18 today. brews would fail outright.
    • Linux is preserved. Casks used to be macOS-only; current Homebrew installs a cask on Linux as long as it doesn't depends_on macos:, and GoReleaser's template emits on_linux with on_intel/on_arm. The generated cask covers the same four platform/arch pairs as the formula it replaces.
    • skip_upload: "auto" so the -rc tags cut by draft_release.yml never point the tap at a prerelease.
    • A postflight hook strips com.apple.quarantine, since the release binaries are unsigned.
  • Both release workflows now pass HOMEBREW_TAP_TOKEN to the GoReleaser step.
  • Renamed the artifact powerctl-clipowerctl, so the install line is brew install kristofferrisa/powerctl/powerctl as Add Homebrew formula/tap for easier installation #14 asked.
  • Fixed archives.format / format_overrides.format, deprecated since v2.6 and warning on every release. goreleaser check now passes clean.
  • README gains a Homebrew section; .gitignore gains dist/.

Verification

Ran GoReleaser v2.18.0 locally against this config:

  • goreleaser check → clean, no deprecation warnings (it flagged binarybinaries and a no-op conflicts.formula on the way, both fixed).
  • goreleaser release --snapshot --clean --skip=publish → built all six targets and wrote dist/homebrew/Casks/powerctl.rb with on_macos/on_linux × on_intel/on_arm, correct URLs and checksums.
  • make check passes.

The publish path itself (the push to the tap) is the one thing not exercised locally — it needs the real token.

Follow-up, not in this PR

Once a real tag lands and the tap gets its first automated commit:

  1. Delete update-formula.yml and its release-creation step from the tap (it also cuts a duplicate GitHub Release per version).
  2. Delete Formula/powerctl-cli.rb.

Left deliberately for after the first successful run, so the old path stays intact if anything goes wrong.

One deviation from plan

I'd intended an alias so existing powerctl-cli installs migrate silently. There isn't a clean mechanism: GoReleaser's conflicts.formula is a no-op that Homebrew removed, and a cask sharing a name with the tap's formula creates resolution ambiguity. Migration is a README line instead — proportionate at v0.3.0 with a tap that's existed since January.

⚡ Built on gilfoyle with Claude Code

Closes the automation half of #14. The tap repo
(KristofferRisa/homebrew-powerctl) currently carries a 150-line workflow
that curls each archive, hashes it, and rewrites the formula from a
heredoc — and nothing ever triggered it, so every formula bump so far was
a manual workflow_dispatch.

GoReleaser already builds those archives and knows their checksums, so it
can write the tap itself. The tap becomes generated output rather than a
repo to maintain, which removes the manual step without giving up the
conventional `brew tap`-shorthand install line.

- Add `homebrew_casks` targeting the tap, using the HOMEBREW_TAP_TOKEN
  secret that already exists but was never wired up. `brews` is not an
  option: it is hard-deprecated as of GoReleaser v2.16 and the release
  action floats to `~> v2`. The generated cask keeps Linux amd64/arm64
  alongside macOS, matching the formula it replaces.
- `skip_upload: auto` so the -rc tags from draft_release.yml never point
  the tap at a prerelease.
- Pass HOMEBREW_TAP_TOKEN to both release workflows.
- Rename the artifact powerctl-cli -> powerctl, so the install line is
  `brew install kristofferrisa/powerctl/powerctl`, per #14.
- Fix archives.format/format_overrides.format, deprecated since v2.6;
  `goreleaser check` now passes with no warnings.
- Document Homebrew install and ignore GoReleaser's dist/.
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