Skip to content

Commit cf9bdad

Browse files
1shoopermanclaude
andauthored
feat: auto-bump homebrew-tap on release (#6)
Adds bump-tap job to release workflow. After a GitHub release is created, computes the new tarball SHA256 and pushes an updated formula to 1shooperman/homebrew-tap via TAP_GITHUB_TOKEN secret. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8218f6d commit cf9bdad

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: write
24+
outputs:
25+
version: ${{ steps.version.outputs.version }}
2426
steps:
2527
- name: Harden runner
2628
uses: step-security/harden-runner@v2
@@ -75,3 +77,46 @@ jobs:
7577
--verify-tag
7678
env:
7779
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
81+
bump-tap:
82+
needs: release
83+
runs-on: ubuntu-latest
84+
permissions:
85+
contents: read
86+
steps:
87+
- name: Harden runner
88+
uses: step-security/harden-runner@v2
89+
with:
90+
egress-policy: block
91+
allowed-endpoints: >
92+
api.github.com:443
93+
github.com:443
94+
objects.githubusercontent.com:443
95+
96+
- name: Checkout tap
97+
uses: actions/checkout@v6
98+
with:
99+
repository: 1shooperman/homebrew-tap
100+
token: ${{ secrets.TAP_GITHUB_TOKEN }}
101+
102+
- name: Compute SHA256
103+
id: sha
104+
run: |
105+
VERSION="${{ needs.release.outputs.version }}"
106+
URL="https://github.com/1shooperman/cli-tools/archive/refs/tags/${VERSION}.tar.gz"
107+
SHA=$(curl -sL "$URL" | shasum -a 256 | awk '{print $1}')
108+
echo "sha=${SHA}" >> "$GITHUB_OUTPUT"
109+
echo "url=${URL}" >> "$GITHUB_OUTPUT"
110+
111+
- name: Bump formula
112+
run: |
113+
VERSION="${{ needs.release.outputs.version }}"
114+
sed -i "s|url \".*\"|url \"${{ steps.sha.outputs.url }}\"|" Formula/cli-tools.rb
115+
sed -i "s|sha256 \".*\"|sha256 \"${{ steps.sha.outputs.sha }}\"|" Formula/cli-tools.rb
116+
117+
- name: Push
118+
run: |
119+
git config user.name "github-actions[bot]"
120+
git config user.email "github-actions[bot]@users.noreply.github.com"
121+
git commit -am "chore: bump cli-tools to ${{ needs.release.outputs.version }}"
122+
git push

0 commit comments

Comments
 (0)