Skip to content

Commit 47dba84

Browse files
authored
Merge pull request #40 from sanketsudake/cask/postflight-steps
cask: emit postflight_steps instead of the deprecated postflight
2 parents 036f1f8 + faafdd8 commit 47dba84

2 files changed

Lines changed: 48 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,26 @@ jobs:
9393
run: nix build .#chrome-cdp --print-build-logs
9494
- name: Smoke-test the built binary
9595
run: ./result/bin/chrome-cdp --version
96+
97+
# The Homebrew cask this repo publishes is generated from .goreleaser.yaml, so
98+
# a mistake in the homebrew_casks block otherwise surfaces at tag time, inside
99+
# a release. `check` validates the config on every push instead.
100+
#
101+
# The schema probe is the trigger for dropping the custom_block workaround:
102+
# `hooks.post.install_steps` is unreleased (goreleaser#6873), and this warns
103+
# on the first push after it lands.
104+
goreleaser:
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v4
108+
109+
- uses: goreleaser/goreleaser-action@v6
110+
with:
111+
version: "~> v2"
112+
args: check
113+
114+
- name: Notice when hooks.post.install_steps ships
115+
run: |
116+
if goreleaser schema | jq -e '.["$defs"].HomebrewCaskHook.properties.install_steps' >/dev/null; then
117+
echo "::warning::hooks.post.install_steps is available — migrate off custom_block (goreleaser#6873)"
118+
fi

‎.goreleaser.yaml‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,29 @@ homebrew_casks:
8181
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
8282
directory: Casks
8383
homepage: "https://github.com/sanketsudake/chrome-cdp-cli"
84-
description: "Drive your already-running local Chrome from the command line over CDP"
84+
description: "Drive your already-running local Chrome from the command-line over CDP"
8585
# Strip the quarantine xattr so the unsigned binary runs without a Gatekeeper prompt.
86-
hooks:
87-
post:
88-
install: |
89-
if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
90-
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/chrome-cdp"]
91-
end
86+
#
87+
# This is the body GoReleaser's own deprecation notice prescribes for
88+
# hooks.post.install_steps, but that key ships in v2.19; until then the only
89+
# way to emit `postflight_steps` is custom_block, because GoReleaser still
90+
# wraps hooks.post.install in Homebrew's deprecated `postflight`.
91+
# The {{ "..." }} escape is needed because GoReleaser templates the rendered
92+
# cask once, and would otherwise read {{staged_path}} as one of its own
93+
# template calls.
94+
#
95+
# TODO(goreleaser#6873): on v2.19, delete custom_block and use
96+
# hooks:
97+
# post:
98+
# install_steps: |
99+
# on_macos do
100+
# run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ .StagedPath }}/chrome-cdp"], must_succeed: false
101+
# end
102+
custom_block: |
103+
postflight_steps do
104+
on_macos do
105+
run "/usr/bin/xattr",
106+
args: ["-dr", "com.apple.quarantine", "{{ "{{staged_path}}" }}/chrome-cdp"],
107+
must_succeed: false
108+
end
109+
end

0 commit comments

Comments
 (0)