Skip to content

v0.40.0

v0.40.0 #49

Workflow file for this run

name: Update Homebrew Formula
on:
release:
types: [released]
jobs:
update-homebrew-formula:
name: Update Homebrew Formula
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Latest Release
id: release
env:
GH_TOKEN: ${{ github.token }}
run: |
# Download files from the latest release and calculate their SHA256 checksums
gh release view --json tagName,assets > release.json
gh release download -p '*apple-darwin*'
echo "VERSION=$(jq -r '.tagName' release.json)" >> $GITHUB_OUTPUT
echo "X86_URL=$(jq -r '.assets[] | select(.name | contains("x86_64-apple-darwin")) | .url' release.json)" >> $GITHUB_OUTPUT
echo "ARM_URL=$(jq -r '.assets[] | select(.name | contains("aarch64-apple-darwin")) | .url' release.json)" >> $GITHUB_OUTPUT
echo "X86_SHA=$(sha256sum ceramic-one_x86_64-apple-darwin.bin.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
echo "ARM_SHA=$(sha256sum ceramic-one_aarch64-apple-darwin.bin.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: Checkout Homebrew Tap
uses: actions/checkout@v4
with:
repository: ceramicnetwork/homebrew-tap
path: homebrew-tap
token: ${{ secrets.GH_TOKEN_PAT }}
- name: Update Homebrew Formula
run: |
cd homebrew-tap
sed -i -E "s|(url \".*ceramic-one_x86_64-apple-darwin.*\")|url \"${{ steps.release.outputs.X86_URL }}\"|" Formula/ceramic-one.rb
sed -i -E "/CPU.intel?/,/sha256/ s/sha256 \"[^\"]*\"/sha256 \"${{ steps.release.outputs.X86_SHA }}\"/" Formula/ceramic-one.rb
sed -i -E "s|(url \".*ceramic-one_aarch64-apple-darwin.*\")|url \"${{ steps.release.outputs.ARM_URL }}\"|" Formula/ceramic-one.rb
sed -i -E "/CPU.arm?/,/sha256/ s/sha256 \"[^\"]*\"/sha256 \"${{ steps.release.outputs.ARM_SHA }}\"/" Formula/ceramic-one.rb
- name: Commit and Push changes
run: |
cd homebrew-tap
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff
git add Formula/ceramic-one.rb
git commit -m "chore: update ceramic-one formula to ${{ steps.release.outputs.VERSION }}"
git push