From 57054a7c02f974403cf9b92fe3c236dc5f119e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asger=20Geel=20Weirs=C3=B8e?= Date: Wed, 6 May 2026 15:26:39 +0200 Subject: [PATCH] ci: auto-update Homebrew tap on release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .gitea/workflows/release.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 6c60166..7fa22bc 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -28,6 +28,13 @@ jobs: - name: Install Rust 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 run: | meson setup builddir --buildtype=release @@ -51,3 +58,21 @@ jobs: tag_name: ${{ github.ref_name }} name: ${{ github.ref_name }} 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