Skip to content

Commit 3da45bc

Browse files
committed
ci: notify Engine-Labs/homebrew-cto on release.published
Listens for release.published events on this repo and dispatches the bump workflow on Engine-Labs/homebrew-cto with the version. Fires when a human clicks "Publish release" on the draft created by the cto-monorepo release pipeline. Job is gated on `vars.BREW_TAP_APP_ID != ''`, so it skips silently until the engine-labs-homebrew-cto GitHub App is provisioned and the secret + variable are configured. No effect on existing release flow until then.
1 parent aec257c commit 3da45bc

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/bump-brew.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Bump Homebrew formula
2+
3+
# Fires when a draft release on this repo is *published*. The cto release
4+
# pipeline (Engine-Labs/cto-monorepo: _release-cli.yml) creates the draft;
5+
# a human reviews and clicks Publish; that publish event triggers this
6+
# workflow, which dispatches the bump workflow on Engine-Labs/homebrew-cto.
7+
8+
on:
9+
release:
10+
types: [published]
11+
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: "Version to bump to (no leading 'v', e.g. 5.71.0). Defaults to the published release tag."
15+
required: false
16+
type: string
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
dispatch-bump:
23+
# Skips silently until the engine-labs-homebrew-cto App is provisioned
24+
# and BREW_TAP_APP_ID is set as an org/repo variable. This lets the
25+
# workflow be committed now without breaking release publishes.
26+
if: ${{ vars.BREW_TAP_APP_ID != '' }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Resolve + validate version
30+
id: ver
31+
env:
32+
INPUT_VERSION: ${{ inputs.version }}
33+
RELEASE_TAG: ${{ github.event.release.tag_name }}
34+
run: |
35+
if [ -n "$INPUT_VERSION" ]; then
36+
VER="$INPUT_VERSION"
37+
else
38+
VER="${RELEASE_TAG#v}"
39+
fi
40+
if ! [[ "$VER" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
41+
echo "Version '$VER' is not clean semver (X.Y.Z); skipping." >&2
42+
exit 1
43+
fi
44+
echo "version=$VER" >> "$GITHUB_OUTPUT"
45+
echo "Will dispatch bump for version: $VER"
46+
47+
- name: Generate App token for Engine-Labs/homebrew-cto
48+
id: app-token
49+
uses: actions/create-github-app-token@v3
50+
with:
51+
app-id: ${{ vars.BREW_TAP_APP_ID }}
52+
private-key: ${{ secrets.BREW_TAP_APP_PRIVATE_KEY }}
53+
owner: Engine-Labs
54+
repositories: homebrew-cto
55+
56+
- name: Dispatch bump workflow
57+
env:
58+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
59+
VERSION: ${{ steps.ver.outputs.version }}
60+
run: |
61+
gh workflow run bump.yml \
62+
--repo Engine-Labs/homebrew-cto \
63+
--ref main \
64+
-f version="$VERSION"
65+
echo "Dispatched bump.yml on Engine-Labs/homebrew-cto for v${VERSION}"

0 commit comments

Comments
 (0)