fix(release): make the cask bump reliably runnable (#33)

The `release: published` trigger does not fire for a release whose draft was
created by tauri-action's GITHUB_TOKEN — verified on v0.8.0, which produced
zero workflow runs after publishing, so the Homebrew cask was never bumped and
the tap stayed empty.

Adds `bump_cask` to the workflow_dispatch inputs so the cask bump can be run
on demand for any tag, and switches the cask job to RELEASE_TAG (which resolves
for both dispatch and release events) instead of GITHUB_REF_NAME.

Also stops the cask template's header comment from being rewritten with the
substituted version and checksums on every render.
This commit is contained in:
2026-09-20 16:37:33 +08:00
committed by GitHub
parent 228660044a
commit fdbfd3d0d2
2 changed files with 22 additions and 15 deletions
+18 -11
View File
@@ -41,8 +41,12 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: tag:
description: 'Existing tag to build, e.g. v0.8.0' description: 'Tag to build or bump the cask for, e.g. v0.8.0'
required: true required: true
bump_cask:
description: 'Only bump the Homebrew cask for `tag` (skip the build)'
type: boolean
default: false
permissions: permissions:
contents: write contents: write
@@ -54,9 +58,10 @@ env:
jobs: jobs:
publish: publish:
# Build + draft release happen on the tag push; the `release: published` # Build + draft release happen on a tag push or a dispatch that isn't a
# event exists only to trigger the cask bump below. # cask-only run. The `release: published` event exists only to trigger the
if: github.event_name != 'release' # cask bump below.
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.bump_cask != true)
env: env:
# Empty when the secret is unset — the tool steps below test for a # Empty when the secret is unset — the tool steps below test for a
# non-empty value before re-signing. # non-empty value before re-signing.
@@ -445,10 +450,12 @@ jobs:
# cleanly until that secret is set, so releases stay green before this is # cleanly until that secret is set, so releases stay green before this is
# configured. # configured.
bump-cask: bump-cask:
# Triggered by `release: published`, NOT the tag push: the GitHub # Normally fires on `release: published`, which requires the DMGs to be
# releases/tags API returns 404 for drafts, so the DMGs are undownloadable # downloadable — the GitHub releases/tags API returns 404 for drafts, so
# until the draft is published. # this cannot run on the tag push. NOTE: a release whose DRAFT was created
if: github.event_name == 'release' # by tauri-action's GITHUB_TOKEN does not reliably emit a `release` event,
# so `workflow_dispatch` with bump_cask=true is the dependable path.
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.bump_cask == true)
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
@@ -474,9 +481,9 @@ jobs:
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
VERSION="${GITHUB_REF_NAME#v}" VERSION="${RELEASE_TAG#v}"
gh release download "$GITHUB_REF_NAME" -p "Gridline_${VERSION}_aarch64.dmg" -O /tmp/arm.dmg gh release download "$RELEASE_TAG" -p "Gridline_${VERSION}_aarch64.dmg" -O /tmp/arm.dmg
gh release download "$GITHUB_REF_NAME" -p "Gridline_${VERSION}_x64.dmg" -O /tmp/intel.dmg gh release download "$RELEASE_TAG" -p "Gridline_${VERSION}_x64.dmg" -O /tmp/intel.dmg
echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "sha_arm=$(shasum -a 256 /tmp/arm.dmg | cut -d' ' -f1)" >> "$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" echo "sha_intel=$(shasum -a 256 /tmp/intel.dmg | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
+4 -4
View File
@@ -1,9 +1,9 @@
# Homebrew Cask formula for Gridline. # Homebrew Cask formula for Gridline.
# #
# This file is the template; `scripts/render-cask.sh` substitutes # This file is the template; `scripts/render-cask.sh` substitutes the version
# @VERSION@ / @ARM_SHA256@ / @INTEL_SHA256@ on each release and pushes the # and the per-arch SHA-256 checksums on each release and pushes the rendered
# rendered file to the `AdrianBonpin/homebrew-gridline` tap as # file to the `AdrianBonpin/homebrew-gridline` tap as `Casks/gridline.rb`.
# `Casks/gridline.rb`. End users then install with # End users then install with
# #
# brew install --cask AdrianBonpin/gridline/gridline # brew install --cask AdrianBonpin/gridline/gridline
# #