From 944fd0d8edc00cf00fac3e13f6f4746a64f86634 Mon Sep 17 00:00:00 2001 From: Moritz Eck Date: Mon, 22 Jun 2026 08:40:13 +0200 Subject: [PATCH] fix(release): validate Homebrew cask in tap checkout --- .github/workflows/release.yml | 7 +++---- Casks/capture-this.rb | 2 +- docs/homebrew-release.md | 16 ++++++++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12b2640..687943d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,8 +127,8 @@ jobs: exit 1 fi - tap_dir="$(mktemp -d)" - git clone "https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/meck93/homebrew-tap.git" "$tap_dir" + HOMEBREW_NO_AUTO_UPDATE=1 brew tap meck93/tap "https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/meck93/homebrew-tap.git" + tap_dir="$(brew --repo meck93/tap)" mkdir -p "$tap_dir/Casks" cp Casks/capture-this.rb "$tap_dir/Casks/capture-this.rb" @@ -137,8 +137,7 @@ jobs: ruby -pi -e 'gsub(/sha256 "[^"]+"/, "sha256 \"#{ENV.fetch("DMG_SHA256")}\"")' "$tap_dir/Casks/capture-this.rb" cd "$tap_dir" - HOMEBREW_NO_AUTO_UPDATE=1 brew tap meck93/tap "$tap_dir" - HOMEBREW_NO_AUTO_UPDATE=1 brew audit --cask --new meck93/tap/capture-this + HOMEBREW_NO_AUTO_UPDATE=1 brew audit --cask meck93/tap/capture-this git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" diff --git a/Casks/capture-this.rb b/Casks/capture-this.rb index 24afe5a..737d99f 100644 --- a/Casks/capture-this.rb +++ b/Casks/capture-this.rb @@ -7,7 +7,7 @@ desc "Native macOS menu bar app for screen recording" homepage "https://github.com/meck93/capture-this" - depends_on macos: ">= :sequoia" + depends_on macos: :sequoia depends_on arch: :arm64 postflight do diff --git a/docs/homebrew-release.md b/docs/homebrew-release.md index 8332f1a..f12fa34 100644 --- a/docs/homebrew-release.md +++ b/docs/homebrew-release.md @@ -49,11 +49,12 @@ The release workflow will: 5. Create or update the GitHub release for `v0.1.0`. 6. Calculate the SHA-256 for `artifacts/CaptureThis.dmg`. 7. Create a GitHub App installation token for `meck93/homebrew-tap`. -8. Clone `meck93/homebrew-tap`. -9. Copy `Casks/capture-this.rb` from this repository into the tap. -10. Update `Casks/capture-this.rb` with the release version and DMG checksum. -11. Register the temporary checkout as `meck93/tap` and run `brew audit --cask --new meck93/tap/capture-this`. -12. Commit and push the tap update. +8. Tap `meck93/homebrew-tap` with the GitHub App token. +9. Resolve the canonical tap checkout with `brew --repo meck93/tap`. +10. Copy `Casks/capture-this.rb` from this repository into the tap checkout. +11. Update `Casks/capture-this.rb` with the release version and DMG checksum. +12. Run `brew audit --cask meck93/tap/capture-this`. +13. Commit and push the tap update. The first successful release creates `Casks/capture-this.rb` in the tap if it does not exist yet. @@ -115,7 +116,10 @@ Validate and push: ```bash brew tap meck93/tap . -brew audit --cask --new meck93/tap/capture-this +tap_dir="$(brew --repo meck93/tap)" +cp Casks/capture-this.rb "$tap_dir/Casks/capture-this.rb" +cd "$tap_dir" +brew audit --cask meck93/tap/capture-this git add Casks/capture-this.rb git commit -m "chore: update CaptureThis to 0.1.0" git push