fix(release): emit postflight_steps in the Homebrew cask - #137
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The generated cask stanza ordering issue remains unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates GoReleaser’s Homebrew cask configuration to emit non-deprecated postflight_steps while preserving quarantine removal.
Changes:
- Replaces the legacy post-install hook with a templated
custom_block. - Documents the fix in
CHANGELOG.md.
File summaries
| File | Summary | Review findings |
|---|---|---|
CHANGELOG.md |
Records the Homebrew deprecation-warning fix. | None. |
.goreleaser.yml |
Emits the Homebrew postflight_steps stanza. |
Moderate (1 vote): generated stanza may violate Homebrew ordering. Nit (2 votes): use “ad hoc”. Nit (1 vote): add coverage for the custom block and literal {{staged_path}}. |
Review details
Suppressed comments (2)
.goreleaser.yml:83
- Because GoReleaser emits
custom_blockat the top of the cask, this placespostflight_stepsbeforeversion, the platform URL stanzas, andbinary. Homebrew's stanza order requirespostflight_stepsafter the artifact stanzas, sobrew stylewill flag the generated cask as out of order even thoughbrew reinstallsucceeds. Please use a template/GoReleaser hook that emits this block in the normal position, or switch tohooks.post.install_stepswhen the release tool supports it.
custom_block: |
postflight_steps do
on_macos do
run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ "{{staged_path}}" }}/mnemon"]
.goreleaser.yml:83
- The release test suite already parses
.goreleaser.yml, but it does not assert the Homebrew cask hook. Please add a fixture/assertion for thiscustom_block—including the literal{{staged_path}}token—so a future GoReleaser/config change cannot silently reintroduce deprecatedpostflightor break the quarantine fix.
custom_block: |
postflight_steps do
on_macos do
run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ "{{staged_path}}" }}/mnemon"]
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if OS.mac? | ||
| system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/mnemon"] | ||
| end | ||
| # The binary is adhoc/linker-signed only (not notarized), so the cask |
Homebrew deprecates the `postflight` stanza; every brew command that loads the generated cask prints "Calling `postflight` is deprecated! Use `postflight_steps` instead." GoReleaser's `hooks.post.install` still renders `postflight do ... end` (goreleaser/goreleaser#6870), so emit the stanza through `custom_block` until a steps-aware hook lands (goreleaser/goreleaser#6873). The declarative DSL maps cleanly: `on_macos` replaces the `if OS.mac?` guard, `run` replaces `system_command`, and Homebrew's `{{staged_path}}` install-steps token is escaped as `{{ "{{staged_path}}" }}` so it survives GoReleaser's template pass. Verified by applying the generated stanza to the installed cask: `brew reinstall --cask mnemon` prints no warning and strips the quarantine attribute.
audreyt
force-pushed
the
fix/cask-postflight-steps
branch
from
September 13, 2026 22:59
3b3999b to
915e711
Compare
Contributor
Author
|
@copilot review |
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.
Homebrew deprecates the
postflightcask stanza. Everybrewcommand that loads the generated cask prints:GoReleaser's
hooks.post.installrenderspostflight do … end— tracked upstream as goreleaser/goreleaser#6870, with a steps-aware hook proposed in goreleaser/goreleaser#6873 (open). Until that lands, emit the stanza throughcustom_block.Change
hooks.post.install→custom_blockcontainingpostflight_steps:on_macos do … endreplaces theif OS.mac?guard (evaluated at install time, same semantics).run "/usr/bin/xattr", args: […]replacessystem_command(fails the install on error, same as before).{{ "{{staged_path}}" }}escapes GoReleaser's template pass so Homebrew's{{staged_path}}install-steps token reaches the generated cask literally. Verified againsttext/template: the escaped form renders{{staged_path}}; the raw form fails to parse.TestReleaseCaskEmitsPostflightStepsintest/mnemond/architectureparses.goreleaser.ymland asserts the cask carriespostflight_steps+ the escaped{{staged_path}}token and nohooks.post.install, so a future config edit cannot silently reintroducepostflight.Known trade-off (stanza order)
custom_blockrenders at the top of the cask, beforeversion—brew styleflags the generated file withCask/StanzaOrderoffenses (verified: 11 correctable offenses on a rendered sample). This is cosmetic:brew install/reinstall/upgradedo not enforce stanza order, and the tap has no style CI. The alternatives are worse:hooks.post.installis style-clean but keeps the deprecation warning (the bug being fixed), and dropping the hook loses the quarantine strip. When goreleaser/goreleaser#6873 ships,hooks.post.install_stepsemits the stanza in the correct position and this can be simplified.Verified
Applied the generated stanza to the installed cask and ran
brew reinstall --cask mnemonon Homebrew 6.x: installs cleanly, prints no deprecation warning, and strips the quarantine attribute from the staged binary.Companion tap-side fix (interim, until the next release regenerates the cask): mnemon-dev/homebrew-tap#2