Skip to content

v1.5.0.160

v1.5.0.160 #8

Workflow file for this run

name: Bump Homebrew tap
# Fires when a release is PUBLISHED (e.g. a human flips a draft to published, which
# emits `release: published`). Dispatches a repository_dispatch to the tap, which
# rewrites Casks/clipp.rb's version + sha256 from this release's SHA256SUMS.txt.
#
# The OTHER path -- a manual `publish: true` release -- is published by the workflow's
# own GITHUB_TOKEN, so GitHub's loop guard emits NO `release` event and this workflow
# never runs; _release.yml dispatches the bump directly in that case. Between the two,
# both publish paths bump the tap exactly once.
#
# Requires the repo secret HOMEBREW_TAP_TOKEN (a PAT that can dispatch to
# martona/homebrew-tap). Until that's set, this no-ops cleanly.
on:
release:
types: [published]
workflow_dispatch:
inputs:
release-tag:
description: "Existing release tag to publish to the tap, e.g. v1.2.3.4"
required: true
type: string
permissions:
contents: read
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- name: Is HOMEBREW_TAP_TOKEN configured?
id: guard
shell: bash
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [[ -n "$HOMEBREW_TAP_TOKEN" ]]; then
echo "ok=true" >> "$GITHUB_OUTPUT"
else
echo "ok=false" >> "$GITHUB_OUTPUT"
echo "::notice::HOMEBREW_TAP_TOKEN not set -- skipping Homebrew tap bump."
fi
- name: Dispatch tap bump
if: steps.guard.outputs.ok == 'true'
shell: bash
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
RELEASE_TAG: ${{ github.event.release.tag_name || inputs['release-tag'] }}
run: |
if [[ -z "$RELEASE_TAG" ]]; then
echo "::error::release tag is required"
exit 1
fi
curl --fail-with-body -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/martona/homebrew-tap/dispatches \
-d "{\"event_type\":\"bump-homebrew-package\",\"client_payload\":{\"target\":\"clipp\",\"tag\":\"$RELEASE_TAG\"}}"