From bfbb1406d68977f57a7c7fbf54d344a5ba68a5ae Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Mar 2026 10:30:28 +0000 Subject: [PATCH] feat: add Homebrew publish workflow Adds a workflow that automatically updates the Homebrew tap formula when a new release is published on GitHub. https://claude.ai/code/session_01C4KV7C4sFRxQ2RBLMMoG7d --- .github/workflows/homebrew.yml | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/homebrew.yml diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml new file mode 100644 index 0000000..824e7e8 --- /dev/null +++ b/.github/workflows/homebrew.yml @@ -0,0 +1,88 @@ +name: Publish to Homebrew + +on: + release: + types: [published] + +jobs: + homebrew: + name: Update Homebrew Formula + runs-on: ubuntu-latest + env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + steps: + - name: Download release binaries + run: | + TAG=${{ github.event.release.tag_name }} + for PLATFORM in darwin-amd64 darwin-arm64 linux-amd64 linux-arm64; do + curl -fL -o "aperiodic-${PLATFORM}" \ + "https://github.com/aperiodic-io/cli/releases/download/${TAG}/aperiodic-${PLATFORM}" + done + + - name: Compute SHA256 checksums + id: sha256 + run: | + echo "darwin_amd64=$(sha256sum aperiodic-darwin-amd64 | awk '{print $1}')" >> $GITHUB_OUTPUT + echo "darwin_arm64=$(sha256sum aperiodic-darwin-arm64 | awk '{print $1}')" >> $GITHUB_OUTPUT + echo "linux_amd64=$(sha256sum aperiodic-linux-amd64 | awk '{print $1}')" >> $GITHUB_OUTPUT + echo "linux_arm64=$(sha256sum aperiodic-linux-arm64 | awk '{print $1}')" >> $GITHUB_OUTPUT + + - name: Checkout Homebrew tap + uses: actions/checkout@v4 + with: + repository: aperiodic-io/homebrew-tap + token: ${{ secrets.HOMEBREW_TAP_TOKEN }} + path: homebrew-tap + + - name: Update formula + run: | + TAG=${{ github.event.release.tag_name }} + VERSION=${TAG#v} + mkdir -p homebrew-tap/Formula + cat > homebrew-tap/Formula/aperiodic.rb << EOF + class Aperiodic < Formula + desc "Aperiodic CLI" + homepage "https://github.com/aperiodic-io/cli" + version "${VERSION}" + license "MIT" + + on_macos do + on_arm do + url "https://github.com/aperiodic-io/cli/releases/download/${TAG}/aperiodic-darwin-arm64" + sha256 "${{ steps.sha256.outputs.darwin_arm64 }}" + end + on_intel do + url "https://github.com/aperiodic-io/cli/releases/download/${TAG}/aperiodic-darwin-amd64" + sha256 "${{ steps.sha256.outputs.darwin_amd64 }}" + end + end + + on_linux do + on_arm do + url "https://github.com/aperiodic-io/cli/releases/download/${TAG}/aperiodic-linux-arm64" + sha256 "${{ steps.sha256.outputs.linux_arm64 }}" + end + on_intel do + url "https://github.com/aperiodic-io/cli/releases/download/${TAG}/aperiodic-linux-amd64" + sha256 "${{ steps.sha256.outputs.linux_amd64 }}" + end + end + + def install + bin.install Dir["aperiodic-*"].first => "aperiodic" + end + + test do + system "#{bin}/aperiodic", "--version" + end + end + EOF + + - name: Commit and push formula + run: | + cd homebrew-tap + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add Formula/aperiodic.rb + git diff --cached --quiet || git commit -m "chore: update aperiodic to ${{ github.event.release.tag_name }}" + git push