Skip to content

fix: use non-deprecated postflight_steps for cask quarantine removal - #3042

Closed
joaofsantos wants to merge 1 commit into
go-task:mainfrom
joaofsantos:fix/cask-postflight-steps-deprecation
Closed

joaofsantos wants to merge 1 commit into
go-task:mainfrom
joaofsantos:fix/cask-postflight-steps-deprecation

Conversation

@joaofsantos

Copy link
Copy Markdown

Summary

brew install/upgrade/untap for the go-task cask currently prints:

Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead.
Please report this issue to the go-task/homebrew-tap tap (not Homebrew/* repositories), or even better, submit a PR to fix it:
  .../go-task/homebrew-tap/Casks/go-task.rb:40

Homebrew's docs page linked from this repo's own .goreleaser.yml comment (https://goreleaser.com/customization/homebrew_casks/) still shows the deprecated postflight pattern this repo currently uses for quarantine removal, but the underlying postflight stanza itself is now deprecated in favor of postflight_steps.

I opened goreleaser/goreleaser#7156 to add an opt-in hooks.use_steps option to GoReleaser (needed because the new _steps stanzas use a restricted declarative DSL, not arbitrary Ruby, so it can't be a silent default-on switch). This PR switches .goreleaser.yml to use it once available, and rewrites the quarantine hook for the new DSL:

     hooks:
+      use_steps: true
       post:
         install: |
-          if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
-            system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/task"]
+          on_macos do
+            run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{staged_path}}/task"]
           end

on_macos do ... end replaces the old /usr/bin/xattr -h existence check as the guard for skipping this on Linux builds — same intent (this hook only makes sense on macOS), expressed in the new DSL's own idiom.

Verification

I couldn't run this repo's full release pipeline (needs a tagged build + goreleaser Pro fields already in .goreleaser.yml), but I did verify end-to-end that the generated cask content is valid, using a build of the goreleaser branch from #7156:

  • Rendered this exact hook content through goreleaser's real cask-building pipeline (doBuildCask).
  • Loaded the resulting postflight_steps block via a real Homebrew installation's Cask::CaskLoader.load — parses with zero deprecation warnings, correct postflight_stepson_macosrun nesting.
  • Validated .goreleaser.yml's homebrew_casks config (including this hook) against goreleaser's config schema via goreleaser check with the same patched build — no schema errors.

Status: draft, blocked on goreleaser/goreleaser#7156

This isn't mergeable yet — hooks.use_steps doesn't exist in any released GoReleaser version. Marking as draft until that PR lands and this repo's GoReleaser dependency is bumped to a version that includes it.

AI was used to help write this change (implementation and verification); I reviewed and verified it per the notes above.

🤖 Generated with Claude Code

Homebrew deprecated the postflight block stanza in favor of
postflight_steps. Every `brew install`/`upgrade`/`untap` involving the
go-task cask currently prints:

  Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead.

This switches to GoReleaser's new (as of goreleaser/goreleaser#7156)
opt-in `hooks.use_steps`, which renders the four hook stanzas using
Homebrew's non-deprecated `_steps` variants, and rewrites the
quarantine-removal hook using the new steps DSL (`on_macos do ... end`
instead of checking whether /usr/bin/xattr exists, `run` instead of
`system_command`).

Note: this depends on goreleaser/goreleaser#7156, which is not merged
yet. Not mergeable until that lands in a released goreleaser version
this repo's CI picks up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vmaerten

Copy link
Copy Markdown
Member

Please read our contribution guide

@vmaerten vmaerten closed this Sep 20, 2026
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.

2 participants