mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Add Homebrew tap auto-update to release workflow
Adds installer/fabro.rb.template and an update-homebrew job that generates the formula from release artifacts and pushes it to fabro-sh/homebrew-tap on each tagged release. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ba67ad9cea
commit
48edaa009d
2 changed files with 75 additions and 0 deletions
43
.github/workflows/release.yml
vendored
43
.github/workflows/release.yml
vendored
|
|
@ -78,3 +78,46 @@ jobs:
|
|||
GH_TOKEN: ${{ github.token }}
|
||||
TAG_NAME: ${{ github.ref_name }}
|
||||
run: gh release create "$TAG_NAME" target/distrib/* --generate-notes
|
||||
|
||||
update-homebrew:
|
||||
name: Update Homebrew Formula
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
|
||||
with:
|
||||
path: target/distrib
|
||||
pattern: artifacts-fabro-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate and push formula
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||
TAG_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
VERSION="${TAG_NAME#v}"
|
||||
|
||||
SHA_AARCH64_DARWIN=$(awk '{print $1}' target/distrib/fabro-aarch64-apple-darwin.tar.gz.sha256)
|
||||
SHA_X86_64_LINUX=$(awk '{print $1}' target/distrib/fabro-x86_64-unknown-linux-gnu.tar.gz.sha256)
|
||||
SHA_AARCH64_LINUX=$(awk '{print $1}' target/distrib/fabro-aarch64-unknown-linux-gnu.tar.gz.sha256)
|
||||
|
||||
sed \
|
||||
-e "s/{{VERSION}}/$VERSION/g" \
|
||||
-e "s/{{SHA_AARCH64_DARWIN}}/$SHA_AARCH64_DARWIN/g" \
|
||||
-e "s/{{SHA_X86_64_LINUX}}/$SHA_X86_64_LINUX/g" \
|
||||
-e "s/{{SHA_AARCH64_LINUX}}/$SHA_AARCH64_LINUX/g" \
|
||||
installer/fabro.rb.template > fabro.rb
|
||||
|
||||
git clone https://x-access-token:${GH_TOKEN}@github.com/fabro-sh/homebrew-tap.git tap
|
||||
cp fabro.rb tap/Formula/fabro.rb
|
||||
cd tap
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add Formula/fabro.rb
|
||||
git diff --cached --quiet || (git commit -m "Update fabro to ${TAG_NAME}" && git push)
|
||||
|
|
|
|||
32
installer/fabro.rb.template
Normal file
32
installer/fabro.rb.template
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
class Fabro < Formula
|
||||
desc "Unified CLI for the Fabro AI framework"
|
||||
homepage "https://fabro.sh"
|
||||
license "MIT"
|
||||
version "{{VERSION}}"
|
||||
|
||||
if OS.mac?
|
||||
if Hardware::CPU.arm?
|
||||
url "https://github.com/fabro-sh/fabro/releases/download/v{{VERSION}}/fabro-aarch64-apple-darwin.tar.gz"
|
||||
sha256 "{{SHA_AARCH64_DARWIN}}"
|
||||
end
|
||||
end
|
||||
|
||||
if OS.linux?
|
||||
if Hardware::CPU.intel?
|
||||
url "https://github.com/fabro-sh/fabro/releases/download/v{{VERSION}}/fabro-x86_64-unknown-linux-gnu.tar.gz"
|
||||
sha256 "{{SHA_X86_64_LINUX}}"
|
||||
end
|
||||
if Hardware::CPU.arm?
|
||||
url "https://github.com/fabro-sh/fabro/releases/download/v{{VERSION}}/fabro-aarch64-unknown-linux-gnu.tar.gz"
|
||||
sha256 "{{SHA_AARCH64_LINUX}}"
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
bin.install "fabro"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("#{bin}/fabro --version")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue