Skip to content

Use install_steps for the Homebrew cask quarantine hook - #411

Open
vladosskins178 wants to merge 1 commit into
darrenburns:mainfrom
vladosskins178:fix/cask-postflight-steps
Open

vladosskins178 wants to merge 1 commit into
darrenburns:mainfrom
vladosskins178:fix/cask-postflight-steps

Conversation

@vladosskins178

Copy link
Copy Markdown

Fixes #409

Homebrew 7.0.4 deprecated the cask postflight block in favour of postflight_steps, so installing or upgrading posting@beta prints:

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

The cask is generated, so this changes .goreleaser.yaml: hooks.post.install becomes hooks.post.install_steps (GoReleaser v2.19+, the release workflow uses ~> v2). The new block uses Homebrew's install steps DSL instead of Ruby, so if OS.mac? becomes on_macos, system_command becomes run, and #{staged_path} becomes {{ .StagedPath }}. This follows GoReleaser's own deprecation notice for this option.

Generated cask, before and after:

-  postflight do
-    if OS.mac?
-      system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/posting"]
+  postflight_steps do
+    on_macos do
+      run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{staged_path}}/posting"]
     end
   end

What I checked:

  • goreleaser check and goreleaser release --snapshot --clean --skip=publish with GoReleaser 2.20.0: the homebrew_casks.hooks.post.install deprecation notice is gone and the cask above is written.
  • Installed the snapshot cask from a local tap with Homebrew 7.0.12 on Linux (homebrew/brew image, archive URLs pointed at the local dist/). Before: the deprecation warning above, and brew style reports Cask/InstallSteps: Casks must use postflight_steps instead of postflight. After: no warning, posting --version works, and that brew style offense is gone. (The other brew style offenses, like the homepage slash, are there before and after.)

Not checked: the xattr step itself on macOS. I have no Mac here, and on Linux on_macos skips it.

Homebrew deprecated the postflight stanza, so installing posting@beta
prints a deprecation warning. GoReleaser's install_steps writes
postflight_steps instead.

Fixes darrenburns#409

This branch has not been deployed

No deployments
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.

Calling postflight is deprecated! Use postflight_steps instead

1 participant