Skip to content

Commit d8b9f28

Browse files
committed
feat: add homebrew formula update to release workflow
1 parent edd1ee3 commit d8b9f28

2 files changed

Lines changed: 59 additions & 87 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,62 @@ jobs:
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
GH_PAT: ${{ secrets.GH_PAT }}
34+
35+
- name: Get version and SHA256
36+
id: release
37+
run: |
38+
VERSION=${GITHUB_REF#refs/tags/}
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
41+
TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/$VERSION.tar.gz"
42+
SHA256=$(curl -sL "$TARBALL_URL" | sha256sum | cut -d' ' -f1)
43+
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
44+
45+
- name: Update Homebrew Formula
46+
run: |
47+
VERSION=${{ steps.release.outputs.version }}
48+
SHA256=${{ steps.release.outputs.sha256 }}
49+
50+
mkdir -p Formula
51+
52+
cat > Formula/agentx.rb << EOF
53+
# typed: false
54+
# frozen_string_literal: true
55+
56+
class Agentx < Formula
57+
desc "CLI tool for managing MCP servers and skills across AI coding agents"
58+
homepage "https://github.com/${{ github.repository }}"
59+
url "https://github.com/${{ github.repository }}/archive/refs/tags/$VERSION.tar.gz"
60+
sha256 "$SHA256"
61+
license "Apache-2.0"
62+
head "https://github.com/${{ github.repository }}.git", branch: "master"
63+
64+
depends_on "go" => :build
65+
66+
def install
67+
ldflags = %W[
68+
-s -w
69+
-X github.com/agentsdance/agentx/internal/version.Version=#{version}
70+
]
71+
system "go", "build", *std_go_args(ldflags: ldflags)
72+
end
73+
74+
test do
75+
assert_match version.to_s, shell_output("#{bin}/agentx version")
76+
end
77+
end
78+
EOF
79+
80+
- name: Commit and push Formula
81+
run: |
82+
git config --local user.email "action@github.com"
83+
git config --local user.name "GitHub Action"
84+
85+
git add Formula/agentx.rb
86+
87+
if git diff --staged --quiet; then
88+
echo "No changes to commit"
89+
else
90+
git commit -m "chore: update homebrew formula to ${{ steps.release.outputs.version }}"
91+
git push origin HEAD:master
92+
fi

.github/workflows/update-homebrew.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)