ci: auto-update Homebrew tap on release
Some checks failed
Test / test (push) Has been cancelled

After uploading the release asset, the workflow now:
1. Computes the SHA256 of the source tarball from the Gitea archive endpoint
2. Clones homebrew-ahfail via token auth, patches url + sha256 in Formula/ahfail.rb
3. Commits and pushes — so `brew upgrade ahfail` works without any manual steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Asger Geel Weirsøe
2026-05-06 15:26:39 +02:00
parent b8a03d72bb
commit 57054a7c02

View File

@@ -28,6 +28,13 @@ jobs:
- name: Install Rust stable - name: Install Rust stable
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
- name: Compute source tarball SHA256
run: |
SHA256=$(curl -fsSL \
"https://gitea.weircon.dk/agw/gtk-ahfail/archive/${{ github.ref_name }}.tar.gz" \
| sha256sum | cut -d' ' -f1)
echo "SOURCE_SHA256=${SHA256}" >> $GITHUB_ENV
- name: Build release - name: Build release
run: | run: |
meson setup builddir --buildtype=release meson setup builddir --buildtype=release
@@ -51,3 +58,21 @@ jobs:
tag_name: ${{ github.ref_name }} tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }} name: ${{ github.ref_name }}
files: ahfail-linux-x86_64.tar.gz files: ahfail-linux-x86_64.tar.gz
- name: Update Homebrew tap
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
git clone \
"https://oauth2:${GITEA_TOKEN}@gitea.weircon.dk/agw/homebrew-ahfail.git" \
tap
cd tap
sed -i "s|url \".*\"|url \"https://gitea.weircon.dk/agw/gtk-ahfail/archive/${TAG}.tar.gz\"|" Formula/ahfail.rb
sed -i "s|sha256 \".*\"|sha256 \"${SOURCE_SHA256}\"|" Formula/ahfail.rb
git config user.email "actions@weircon.dk"
git config user.name "Gitea Actions"
git add Formula/ahfail.rb
git diff --cached --quiet || git commit -m "chore: update ahfail to ${TAG}"
git push