From 71eb637bbe9d3bf278b11973987c5f33b4fcd07b Mon Sep 17 00:00:00 2001 From: Daniel Young <9008637+YoungDan@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:07:20 +0100 Subject: [PATCH] Call Homebrew update after CLI release publication --- .github/workflows/homebrew.yml | 22 +++++++++++++++++----- .github/workflows/release.yml | 12 ++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 94f8cc8..992442e 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -4,6 +4,15 @@ name: Homebrew Tap on: + workflow_call: + inputs: + version: + description: Published CLI release tag. + required: true + type: string + secrets: + HOMEBREW_TAP_TOKEN: + required: true workflow_dispatch: inputs: version: @@ -24,7 +33,7 @@ jobs: bump-formula: name: Open Homebrew tap PR # Manual dispatch always runs; release-triggered runs skip prereleases. - if: ${{ github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false }} + if: ${{ github.event_name != 'release' || github.event.release.prerelease == false }} runs-on: ubuntu-latest steps: - name: Resolve release version @@ -32,18 +41,21 @@ jobs: shell: bash run: | set -euo pipefail - if [ -n "${{ github.event.release.tag_name }}" ]; then - TAG="${{ github.event.release.tag_name }}" - elif [ -n "${{ inputs.version }}" ]; then - TAG="${{ inputs.version }}" + if [ -n "$EVENT_TAG" ]; then + TAG="$EVENT_TAG" + elif [ -n "$INPUT_TAG" ]; then + TAG="$INPUT_TAG" else TAG=$(gh release view --repo "${{ github.repository }}" --json tagName -q .tagName) fi + [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] VERSION="${TAG#v}" echo "tag=${TAG}" >> "$GITHUB_OUTPUT" echo "version=${VERSION}" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + EVENT_TAG: ${{ github.event.release.tag_name }} + INPUT_TAG: ${{ inputs.version }} - name: Download release assets shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ebc2905..79a1f58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -229,6 +229,18 @@ jobs: git tag -f v1 "$(git rev-parse HEAD)" git push origin refs/tags/v1 --force + homebrew: + name: Update Homebrew tap + needs: publish + if: ${{ !contains(github.event_name == 'push' && github.ref_name || inputs.tag, '-') }} + uses: ./.github/workflows/homebrew.yml + with: + version: ${{ github.event_name == 'push' && github.ref_name || inputs.tag }} + secrets: + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + permissions: + contents: read + provenance: name: SLSA provenance # Depends on hashes for the subjects and publish so the release exists