@@ -130,6 +130,17 @@ jobs:
130130 with :
131131 path : release-artifacts
132132
133+ - name : Compute SHA256 for macOS DMGs
134+ id : dmg_shas
135+ run : |
136+ set -euo pipefail
137+ VERSION="${{ needs.version-check.outputs.version }}"
138+ ARM_DMG="release-artifacts/release-macos/API Key Health Checker-${VERSION}-arm64.dmg"
139+ INTEL_DMG="release-artifacts/release-macos/API Key Health Checker-${VERSION}-x64.dmg"
140+
141+ echo "ARM_SHA=$(sha256sum "$ARM_DMG" | awk '{print $1}')" >> "$GITHUB_OUTPUT"
142+ echo "INTEL_SHA=$(sha256sum "$INTEL_DMG" | awk '{print $1}')" >> "$GITHUB_OUTPUT"
143+
133144 - name : Publish release
134145 uses : softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
135146 with :
@@ -144,3 +155,27 @@ jobs:
144155 release-artifacts/**/*.AppImage
145156 env :
146157 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
158+
159+ - name : Checkout Homebrew tap
160+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
161+ with :
162+ repository : nbox/homebrew-tap
163+ token : ${{ secrets.HOMEBREW_TAP_TOKEN }}
164+ path : tap
165+
166+ - name : Update cask in tap repo
167+ run : |
168+ set -euo pipefail
169+ VERSION="${{ needs.version-check.outputs.version }}"
170+ ARM_SHA="${{ steps.dmg_shas.outputs.ARM_SHA }}"
171+ INTEL_SHA="${{ steps.dmg_shas.outputs.INTEL_SHA }}"
172+ CASK="tap/Casks/api-key-health-checker.rb"
173+
174+ perl -i -pe 's/^ version ".*"$/ version "'"$VERSION"'"/' "$CASK"
175+ perl -0777 -i -pe 's/sha256 arm:\s*".*?",\s*\n\s*intel:\s*".*?"/sha256 arm: "'"$ARM_SHA"'",\n intel: "'"$INTEL_SHA"'"/s' "$CASK"
176+
177+ git -C tap config user.name "github-actions[bot]"
178+ git -C tap config user.email "41898282+github-actions[bot]@users.noreply.github.com"
179+ git -C tap add Casks/api-key-health-checker.rb
180+ git -C tap commit -m "api-key-health-checker $VERSION" || exit 0
181+ git -C tap push
0 commit comments