|
| 1 | +name: Update Homebrew |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + update-formula: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Get release info |
| 12 | + id: release |
| 13 | + run: | |
| 14 | + VERSION="${GITHUB_REF_NAME#v}" |
| 15 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 16 | +
|
| 17 | + - name: Download release assets |
| 18 | + run: | |
| 19 | + gh release download ${{ github.ref_name }} -R omar16100/parsnip -p "*.tar.gz" |
| 20 | + env: |
| 21 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 22 | + |
| 23 | + - name: Compute SHA256 hashes |
| 24 | + id: sha |
| 25 | + run: | |
| 26 | + echo "arm64=$(shasum -a 256 parsnip-macos-arm64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT |
| 27 | + echo "amd64=$(shasum -a 256 parsnip-macos-amd64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT |
| 28 | + echo "linux=$(shasum -a 256 parsnip-linux-amd64.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT |
| 29 | +
|
| 30 | + - name: Checkout homebrew-tap |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: omar16100/homebrew-tap |
| 34 | + token: ${{ secrets.HOMEBREW_TAP_TOKEN }} |
| 35 | + |
| 36 | + - name: Update formula |
| 37 | + run: | |
| 38 | + cat > Formula/parsnip.rb << 'EOF' |
| 39 | + class Parsnip < Formula |
| 40 | + desc "Local-first memory graph for AI assistants" |
| 41 | + homepage "https://omar16100.github.io/parsnip/" |
| 42 | + version "${{ steps.release.outputs.version }}" |
| 43 | + license any_of: ["MIT", "Apache-2.0"] |
| 44 | +
|
| 45 | + on_macos do |
| 46 | + on_arm do |
| 47 | + url "https://github.com/omar16100/parsnip/releases/download/v#{version}/parsnip-macos-arm64.tar.gz" |
| 48 | + sha256 "${{ steps.sha.outputs.arm64 }}" |
| 49 | + end |
| 50 | + on_intel do |
| 51 | + url "https://github.com/omar16100/parsnip/releases/download/v#{version}/parsnip-macos-amd64.tar.gz" |
| 52 | + sha256 "${{ steps.sha.outputs.amd64 }}" |
| 53 | + end |
| 54 | + end |
| 55 | +
|
| 56 | + on_linux do |
| 57 | + on_intel do |
| 58 | + url "https://github.com/omar16100/parsnip/releases/download/v#{version}/parsnip-linux-amd64.tar.gz" |
| 59 | + sha256 "${{ steps.sha.outputs.linux }}" |
| 60 | + end |
| 61 | + end |
| 62 | +
|
| 63 | + def install |
| 64 | + bin.install "parsnip" |
| 65 | + end |
| 66 | +
|
| 67 | + test do |
| 68 | + system "#{bin}/parsnip", "--version" |
| 69 | + end |
| 70 | + end |
| 71 | + EOF |
| 72 | +
|
| 73 | + - name: Commit and push |
| 74 | + run: | |
| 75 | + git config user.name "github-actions[bot]" |
| 76 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 77 | + git add Formula/parsnip.rb |
| 78 | + git commit -m "Update parsnip to ${{ steps.release.outputs.version }}" |
| 79 | + git push |
0 commit comments