v0.31.0 #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |