fix(release): emit postflight_steps in the Homebrew cask - #11
Merged
Merged
Conversation
goreleaser renders homebrew_casks.hooks.post.install as a Ruby `postflight` block, which Homebrew has deprecated in favour of the declarative `postflight_steps`. Every brew command touching the cask printed Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead. and told the user to report it to the tap. Official taps already reject flight blocks; third-party taps keep them only until a later removal, and after that the quarantine strip would silently stop running and Gatekeeper would refuse the unsigned binary. goreleaser v2.18.1 cannot emit the new stanza - goreleaser/goreleaser#6873 adds hooks.post.install_steps and is unreleased - so the block is written through custom_block, as a `run` step invoking /usr/bin/xattr. Homebrew's {{staged_path}} token is escaped, because goreleaser templates the whole cask. must_succeed: false is kept on purpose. The old system_command never raised either, and `xattr -d` exits 1 when the attribute is absent, which would fail the install over nothing. stderr stays visible. custom_block puts the stanza ahead of the artifacts, which `brew style` flags and installing ignores; the move to install_steps fixes that. docs/release.md and docs/security.md name the new stanza, and security.md no longer compares the strip to `brew install --cask --no-quarantine`, a flag Homebrew has removed. Verified on an Apple Silicon Mac against v0.6.0. A cask with no strip installs a quarantined binary that Gatekeeper refuses. The cask as goreleaser v2.18.1 renders it installs and reinstalls with no deprecation warning, leaves no com.apple.quarantine attribute, and monmux version and monmux info run.
The macOS handle is the display UUID, which identifies a physical unit and is redacted like a serial. The Linux handle is the connector name, which is not private. The difference shows side by side in `monmux info`, so the README's redaction paragraph now says why.
…around The custom_block exists only because goreleaser cannot emit postflight_steps yet. The comment now names the issue and the pull request that fixes it, and says what to do once a release carries hooks.post.install_steps: bump GORELEASER_VERSION in both workflows, move the block there, and drop the stanza-order note.
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.
Summary
Installing the cask from the tap printed a deprecation warning on every
brewcommand that touched it:Cause
goreleaser renders
homebrew_casks.hooks.post.installas a Rubypostflight do … endblock. Homebrew has replaced flight blocks with the declarative*_stepsstanzas. Official taps already reject the old blocks (Homebrew/brew#23366); third-party taps get this warning until a later removal. Once that removal lands, the quarantine strip would silently stop running and Gatekeeper would refuse the unsigned binary. The tap file is generated, so the fix has to be in.goreleaser.yaml.Fix
goreleaser v2.18.1 has no option that emits the new stanza. goreleaser/goreleaser#6873 adds
hooks.post.install_steps, but it is still open. Until it ships, the block goes throughcustom_block:{{staged_path}}token.must_succeed: falseis deliberate. The oldsystem_commandnever raised either, andxattr -dexits 1 when the attribute is absent, which would fail the install for no reason. stderr stays visible, so a real failure still shows.custom_blockputs the stanza before the artifact stanzas.brew styleflags that order; installing ignores it, and the tap runs no style check. Moving toinstall_stepsonce goreleaser releases it fixes the order. The YAML comment says so.Docs
docs/release.mdanddocs/security.mdname the new stanza.docs/security.mdno longer compares the strip tobrew install --cask --no-quarantine, because Homebrew removed that flag.README.mdadds one sentence on whymonmux infomasksHandle:on macOS but not on Linux. The macOS handle is the display UUID, redacted like a serial; the Linux handle is only the connector name. That difference is intended, and now written down.Testing
goreleaser release --snapshot --clean --skip=publish,signwith the pinned v2.18.1: the generateddist/homebrew/Casks/monmux.rbcontains the block above with a literal{{staged_path}}, and nopostflight doorpreflight do.com.apple.quarantine, and running it brings up Gatekeeper's "Apple could not verify" dialog.xattr -lshows no quarantine attribute, andmonmux version(exit 0) andmonmux inforun.make checkpasses.Pull request checklist
mainbranchmake checklocally before creating the commit and it has run successfullyWIPcommits in this PRMonitor writes
None.
internal/catalog/models.yamlis not in the diff, and no code changed. The onlymonmuxcommands run on hardware wereversionandinfo, both read-only, run by hand on the Mac.internal/catalog/models.yaml, the evidence is in the entry, and the Summary above says which modeland which input it enables — not applicable
Type of changes