From 40199aaf69daad01d5fecf39c27ac4f44c28a9ad Mon Sep 17 00:00:00 2001 From: piekstra Date: Tue, 27 Oct 2026 09:39:17 -0400 Subject: [PATCH] fix(release): write the cask postflight as install steps The release workflow installs GoReleaser `~> v2`, which now resolves to 2.19. That version deprecates `homebrew_casks.hooks.post.install`, and the workflow's `goreleaser check` fails on any deprecated property, so the v0.10.350 release failed before building. Move the postflight to `install_steps` with `{{ .StagedPath }}`. GoReleaser renders it as the `postflight_steps` block the shared modernizer used to produce, and the modernizer passes it through unchanged. The package render check now asserts that block holds only run steps and that no legacy postflight block is rendered. The Arch package check's pinned GoReleaser moves to v2.19.0, which reads `install_steps`. Twapp-Session: c2de2117-f69b-4a85-9871-7be95226e6fe --- .github/workflows/arch-package.yml | 2 +- .goreleaser.yml | 4 ++-- scripts/verify-package-render.sh | 21 ++++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/arch-package.yml b/.github/workflows/arch-package.yml index 8db1ccdd..ab5b6b00 100644 --- a/.github/workflows/arch-package.yml +++ b/.github/workflows/arch-package.yml @@ -24,7 +24,7 @@ jobs: go-version-file: go.mod - uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 with: - version: v2.18.2 + version: v2.19.0 args: release --snapshot --clean --skip=before - name: Verify rendered packages run: scripts/verify-package-render.sh diff --git a/.goreleaser.yml b/.goreleaser.yml index f5a5d433..998b44df 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -113,8 +113,8 @@ homebrew_casks: description: Automated pull-request review CLI hooks: post: - install: | - system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/cr"] + install_steps: | + run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ .StagedPath }}/cr"] caveats: | To configure cr, follow the setup examples in the README: https://github.com/open-cli-collective/codereview-cli#authentication-and-setup diff --git a/scripts/verify-package-render.sh b/scripts/verify-package-render.sh index bdccdac3..1bfefd89 100755 --- a/scripts/verify-package-render.sh +++ b/scripts/verify-package-render.sh @@ -40,22 +40,25 @@ require_grep 'binary "cr"' "$cask" require_grep 'open-cli-collective/codereview-cli/releases/download/v' "$cask" require_grep 'cr_v#{version}_darwin_arm64.tar.gz' "$cask" require_grep 'cr_v#{version}_darwin_amd64.tar.gz' "$cask" -require_grep '"com.apple.quarantine", "#{staged_path}/cr"' "$cask" +require_grep '"com.apple.quarantine", "{{staged_path}}/cr"' "$cask" -# The shared release workflow rewrites this legacy postflight block into -# Homebrew's install-step DSL, which has no system_command, by turning each line -# that starts with system_command into a run step. Any other statement survives -# the rewrite and makes Homebrew reject the whole cask as invalid. +# GoReleaser renders the install_steps hook as Homebrew's install-step DSL, +# which has no system_command: any statement other than a run step makes +# Homebrew reject the whole cask as invalid. A legacy postflight block means the +# hook moved back to GoReleaser's deprecated install key, which fails +# `goreleaser check` in the release workflow. ruby - "$cask" <<'RUBY' source = File.read(ARGV.fetch(0)) -body = source[/ postflight do\n(.*?)\n end/m, 1] -raise "postflight body missing" unless body +raise "legacy postflight block present" if source.match?(/^ postflight do$/) + +body = source[/ postflight_steps do\n(.*?)\n end/m, 1] +raise "postflight_steps body missing" unless body body.each_line do |line| next if line.strip.empty? - next if line.match?(/\A\s*system_command\s/) + next if line.match?(/\A\s*run\s/) - raise "postflight line is not a bare system_command call: #{line.strip}" + raise "postflight_steps line is not a run step: #{line.strip}" end puts "rendered package hook check OK" RUBY