From 65b22daa10e9bb7cc19043200823572b2310f99c Mon Sep 17 00:00:00 2001 From: Grigori Kartashyan Date: Fri, 6 Feb 2026 00:00:26 +0100 Subject: [PATCH] Add Homebrew cask auto-update on release Add update-homebrew-cask job to build-release workflow that: - Downloads the DMG after the Mac build completes - Computes its SHA256 hash - Dispatches a repository_dispatch event to softorize/homebrew-tap to automatically update the PostAI cask Requires TAP_GITHUB_TOKEN secret with contents:write on homebrew-tap. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/build-release.yml | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index ca70ded..72c6d92 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -159,3 +159,46 @@ jobs: name: PostAI-Linux-x64 path: release/*.AppImage retention-days: 7 + + # ============================================ + # Update Homebrew cask on release + # ============================================ + update-homebrew-cask: + runs-on: ubuntu-latest + needs: [build-electron-mac] + if: github.event_name == 'release' + steps: + - name: Extract version from tag + id: version + run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + + - name: Download DMG from release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release download "${{ github.event.release.tag_name }}" \ + --repo "${{ github.repository }}" \ + --pattern "PostAI-*-arm64.dmg" \ + --dir . + + - name: Compute SHA256 + id: sha + run: | + SHA=$(shasum -a 256 PostAI-*-arm64.dmg | awk '{print $1}') + echo "sha256=${SHA}" >> "$GITHUB_OUTPUT" + + - name: Dispatch update to homebrew-tap + env: + TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} + run: | + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${TAP_GITHUB_TOKEN}" \ + https://api.github.com/repos/Softorize/homebrew-tap/dispatches \ + -d '{ + "event_type": "update-postai", + "client_payload": { + "version": "${{ steps.version.outputs.version }}", + "sha256": "${{ steps.sha.outputs.sha256 }}" + } + }'