Repository navigation
Move the cask hook to install steps and put tag notes above the changelog - #4
Merged
Merged
Conversation
GoReleaser 2.19 deprecated hooks.post.install, which writes a Ruby postflight block, and goreleaser check exits 2 on deprecated properties. Homebrew 7 also warns about postflight every time it loads the cask. install_steps writes the declarative postflight_steps stanza instead. The steps DSL takes no arbitrary Ruby, so the File.executable? guard becomes on_macos, which Homebrew evaluates at install time. A run step whose executable is missing still fails the install with exit 127, so Linux has to skip the step rather than run it. must_succeed: false keeps macOS installs alive when the attribute is already absent. Loading the cask needs Homebrew 6.0.16 or later, the first release whose run step takes must_succeed.
release.header renders .TagBody, so a note written in the tag message at tag time lands above GoReleaser's generated changelog. A tag with only a subject line has no body, and its release stays as before. The .TagBody of a lightweight tag is the tagged commit's message body, which would go out as the note without any warning. The release job now fetches the tag objects again, in case checkout replaced them with lightweight refs, and fails unless the pushed ref is an annotated tag. The tagging steps are written down at the top of release.yml.
usmanbashir
marked this pull request as ready for review
October 25, 2026 09:42
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
goreleaser-checkfails onmainbecause CI now installs GoReleaser 2.19.0. That release deprecatedhomebrew_casks.hooks.post.install, andgoreleaser checkexits 2 when a config uses deprecated properties. The first commit moves the macOS quarantine hook toinstall_steps, which writes Homebrew's declarativepostflight_stepsstanza instead of a Rubypostflightblock.The second commit puts the annotated tag's message body above the generated changelog, so the release note gets written at tag time. The release job now refuses a tag that isn't annotated.
Changes
.goreleaser.yaml:install_steps, withon_macos do run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ .StagedPath }}/clau"], must_succeed: false end. GoReleaser renders{{ .StagedPath }}as Homebrew's{{staged_path}}token, which Homebrew expands at install time.release.headeris"{{ .TagBody }}"..github/workflows/release.yml:git fetch --force --tags. It fails the job unlessgit cat-file -t "$GITHUB_REF_NAME"printstag.git tag -a, with a subject line, a blank line, then the note. Write headings as bold text, because git strips#lines. Alternatively, use--cleanup=verbatimwith-F, since in the editor it also keeps git's own#instructions.The guard
The steps DSL takes no arbitrary Ruby, so
File.executable?couldn't come along. Homebrew 7.0.10's source (install_steps.rb,system_command.rb) and the Cask Cookbook's*flight_stepssection settle what's supported:must_succeed: falseonrun: supported since 6.0.16. The default istrue, and a failing command aborts the install.on_macosandon_linuxblocks, plusif_path_existsandunless_path_exists, since 6.0.12. The runner evaluates them at install time.must_succeedis true.--no-quarantinehas been removed.So
on_macosreplaces the file check.must_succeed: falsestays, so a macOS install still succeeds if the attribute is already gone. GoReleaser's cask docs give the sameon_macosform for unsigned binaries.Behavior notes
runacceptsmust_succeed:. Older Homebrew fails when it loads the cask, on macOS and Linux alike.brew updatebrings a current Homebrew along with the new cask, so this only affects an old Homebrew with auto-update turned off.Warning: Calling postflight is deprecated! Use postflight_steps instead.every time it loads the published cask. The next release's cask doesn't trigger it..TagBody, so its release body is the changelog alone, as today.## Changelog. A CommonMark renderer (goldmark) still renders it as a heading after a list or a paragraph. I didn't check GitHub's own renderer.Release note draft
Test plan
goreleaser checkwith v2.19.0, the binary CI downloads: exits 2 onmainwith the CI error, and 0 on this branch.goreleaser release --snapshot --cleanwritespostflight_steps do on_macos do run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{staged_path}}/clau"], must_succeed: false end endtodist/homebrew/Casks/clau.rb. Homebrew 7.0.10 loads it as arunstep with anon: macosguard andallow_failure: true./usr/bin/xattr), using renamed copies of the snapshot cask in a throwaway local tap:on_macos,must_succeed: falsestill installs. Homebrew printsenv: '/usr/bin/xattr': No such file or directory.must_succeed, the install fails with exit 127 and is rolled back.xattrstep should run. That path hasn't been exercised.--snapshotskips the changelog and the release, andrelease.headeris only rendered while publishing, so a snapshot can't show it. Instead, I ran the real v2.19.0goreleaser releaseagainst a local stand-in for the GitHub API, set throughgithub_urls. It ran in a throwaway clone with a localv0.5.0tag, never pushed. I read the body it sent:## Changelog, and git has already stripped a#line from it.run:block, extracted withyqand run underbash -eagainst a local bare repo:::error::.git fetch --force --tags.actionlintwith shellcheck is clean on both workflows.go test -count=1 ./...,go vet ./...andgofmt -l .are clean.