feat: bump Homebrew cask on release
This commit is contained in:
@@ -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.
|
||||
# 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
|
||||
Reference in New Issue
Block a user