|
29 | 29 | - uses: softprops/action-gh-release@v2 |
30 | 30 | with: |
31 | 31 | files: ${{ matrix.archive }} |
| 32 | + |
| 33 | + update-homebrew: |
| 34 | + needs: build |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Get tag version |
| 38 | + id: tag |
| 39 | + run: echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" |
| 40 | + |
| 41 | + - name: Compute source tarball SHA256 |
| 42 | + id: sha |
| 43 | + run: | |
| 44 | + url="https://github.com/devwhodevs/engraph/archive/refs/tags/${{ steps.tag.outputs.version }}.tar.gz" |
| 45 | + sha=$(curl -sL "$url" | sha256sum | cut -d' ' -f1) |
| 46 | + echo "sha256=$sha" >> "$GITHUB_OUTPUT" |
| 47 | +
|
| 48 | + - name: Update Homebrew formula |
| 49 | + env: |
| 50 | + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} |
| 51 | + run: | |
| 52 | + git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/devwhodevs/homebrew-tap.git |
| 53 | + cd homebrew-tap |
| 54 | +
|
| 55 | + cat > Formula/engraph.rb << 'FORMULA' |
| 56 | + class Engraph < Formula |
| 57 | + desc "Local semantic search for Obsidian vaults" |
| 58 | + homepage "https://github.com/devwhodevs/engraph" |
| 59 | + url "https://github.com/devwhodevs/engraph/archive/refs/tags/TAG.tar.gz" |
| 60 | + sha256 "SHA256" |
| 61 | + license "MIT" |
| 62 | +
|
| 63 | + depends_on "rust" => :build |
| 64 | +
|
| 65 | + def install |
| 66 | + system "cargo", "install", *std_cargo_args |
| 67 | + end |
| 68 | +
|
| 69 | + test do |
| 70 | + assert_match "engraph", shell_output("#{bin}/engraph --help") |
| 71 | + end |
| 72 | + end |
| 73 | + FORMULA |
| 74 | +
|
| 75 | + sed -i "s|TAG|${{ steps.tag.outputs.version }}|g" Formula/engraph.rb |
| 76 | + sed -i "s|SHA256|${{ steps.sha.outputs.sha256 }}|g" Formula/engraph.rb |
| 77 | +
|
| 78 | + # Remove leading whitespace from heredoc |
| 79 | + sed -i 's/^ //' Formula/engraph.rb |
| 80 | +
|
| 81 | + git config user.name "github-actions[bot]" |
| 82 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 83 | + git add Formula/engraph.rb |
| 84 | + git commit -m "Update engraph to ${{ steps.tag.outputs.version }}" |
| 85 | + git push |
0 commit comments