From 2d6b576d3a96a4f932c87afbf52d32de9c3601bf Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Sun, 16 Aug 2026 18:42:36 +0800 Subject: [PATCH] feat: bump Homebrew cask on release --- .github/workflows/release.yml | 59 ++++++++++++++++++++++++- README.md | 12 +++++ packaging/homebrew/gridline.rb.template | 54 ++++++++++++++++++++++ scripts/render-cask.sh | 41 +++++++++++++++++ src-tauri/Cargo.lock | 2 +- 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 packaging/homebrew/gridline.rb.template create mode 100755 scripts/render-cask.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e190f4..6f80cd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -320,4 +320,61 @@ jobs: # Assets use tauri-action's default versioned naming (e.g. # Gridline_0.7.5_aarch64.dmg, Gridline-0.7.5-1.x86_64.rpm) and the # README download tables link to them statically per release — - # remember to update both README tables when cutting a new version. \ No newline at end of file + # remember to update both README tables when cutting a new version. + + # After the installers are uploaded, refresh the Homebrew cask in the + # AdrianBonpin/homebrew-gridline tap: hash the freshly-published DMGs, + # render Casks/gridline.rb from the template, and push it. Users then get + # the new version via `brew upgrade --cask gridline`. + # + # Requires the HOMEBREW_TAP_TOKEN secret (a PAT with `repo` scope on the tap + # repo — the default GITHUB_TOKEN cannot push to a different repo). The job + # no-ops until that secret is set, so releases stay green before this is + # configured. + bump-cask: + needs: publish + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Resolve version and DMG checksums + id: meta + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${GITHUB_REF_NAME#v}" + gh release download "$GITHUB_REF_NAME" -p "Gridline_${VERSION}_aarch64.dmg" -O /tmp/arm.dmg + gh release download "$GITHUB_REF_NAME" -p "Gridline_${VERSION}_x64.dmg" -O /tmp/intel.dmg + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "sha_arm=$(shasum -a 256 /tmp/arm.dmg | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" + echo "sha_intel=$(shasum -a 256 /tmp/intel.dmg | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" + + - name: Checkout tap repo + uses: actions/checkout@v4 + with: + repository: AdrianBonpin/homebrew-gridline + token: ${{ secrets.HOMEBREW_TAP_TOKEN }} + path: tap + + - name: Render and push cask + env: + VERSION: ${{ steps.meta.outputs.version }} + SHA_ARM: ${{ steps.meta.outputs.sha_arm }} + SHA_INTEL: ${{ steps.meta.outputs.sha_intel }} + run: | + mkdir -p tap/Casks + ./scripts/render-cask.sh "$VERSION" "$SHA_ARM" "$SHA_INTEL" > tap/Casks/gridline.rb + cat tap/Casks/gridline.rb + cd tap + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add Casks/gridline.rb + if git diff --cached --quiet; then + echo "cask already up to date" + else + git commit -m "gridline $VERSION" + git push + fi \ No newline at end of file diff --git a/README.md b/README.md index 08c9f4b..e5c18b3 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,16 @@ Grab the installer for your OS from the [latest release](https://github.com/Adri | **Fedora / RHEL / openSUSE** | x86_64 | [Gridline-0.7.10-1.x86_64.rpm](https://github.com/AdrianBonpin/gridline/releases/download/v0.7.10/Gridline-0.7.10-1.x86_64.rpm) | | **Other Linux** | amd64 | [Gridline_0.7.10_amd64.AppImage](https://github.com/AdrianBonpin/gridline/releases/download/v0.7.10/Gridline_0.7.10_amd64.AppImage) | +**macOS via Homebrew** (recommended for Mac users): + +```bash +brew install --cask AdrianBonpin/gridline/gridline +# or, after a one-time `brew tap AdrianBonpin/gridline`: +brew install --cask gridline +``` + +The cask strips the macOS quarantine flag automatically during install, so **no manual `xattr` step is needed** on the Homebrew path — the app just launches. (Direct-DMG downloads still need the [first-launch instructions](#installers-are-unsigned-for-now) below.) + > **macOS first launch:** macOS may say *"Gridline is damaged and can't be opened"* or *"the developer cannot be verified"* — this is expected; the app isn't Developer-ID signed/notarized yet. See the [macOS first-launch instructions](#installers-are-unsigned-for-now) (right-click → Open, or the one-time `xattr` fix). Not sure if your Mac is Intel or Apple Silicon? See [Which file should I download?](#which-file-should-i-download) below.