Skip to content

Commit

Permalink
Automate brew update in release-cli.yml
Browse files Browse the repository at this point in the history
Related to mediar-ai#692

Automate the official brew update in the `release-cli.yml` workflow for macOS.

* **Formula/screenpipe.rb**
  - Update the `version` field to "0.1.99".
  - Update the `sha256` field for both `x86_64` and `arm64`.
  - Update the `url` field to match the new version.

* **.github/workflows/release-cli.yml**
  - Add a step to update the Homebrew formula after calculating the SHA256.
  - Add a step to create a pull request to update the Homebrew formula.
  • Loading branch information
vishwamartur committed Nov 19, 2024
1 parent 7abf790 commit 62fba2b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,27 @@ jobs:
echo "Warning: $file not found"
fi
done
- name: Update Homebrew Formula
run: |
export VERSION=${{ env.VERSION }}
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git fetch origin main
git checkout -b update-formula-${{ github.sha }}
git merge origin/main --no-edit
sed -i '' 's/version ".*"/version "'$VERSION'"/' Formula/screenpipe.rb
sed -i '' 's/sha256 ".*" # x86_64/sha256 "'${{ env.MAC_SHA256_x86_64-apple-darwin }}'" # x86_64/' Formula/screenpipe.rb
sed -i '' 's/sha256 ".*" # arm64/sha256 "'${{ env.MAC_SHA256_aarch64-apple-darwin }}'" # arm64/' Formula/screenpipe.rb
sed -i '' 's|v[0-9.]*\/screenpipe-[0-9.]*-x86_64-apple-darwin|v'$VERSION'\/screenpipe-'$VERSION'-x86_64-apple-darwin|' Formula/screenpipe.rb
sed -i '' 's|v[0-9.]*\/screenpipe-[0-9.]*-aarch64-apple-darwin|v'$VERSION'\/screenpipe-'$VERSION'-aarch64-apple-darwin|' Formula/screenpipe.rb
git add Formula/screenpipe.rb
git commit -m "chore: update brew to version ${{ env.VERSION }}"
git push -u origin update-formula-${{ github.sha }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
gh pr create --base main --head update-formula-${{ github.sha }} --title "Update Homebrew formula" --body "Automated PR to update Homebrew formula"
10 changes: 5 additions & 5 deletions Formula/screenpipe.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
class Screenpipe < Formula
desc "Library to build personalized AI powered by what you've seen, said, or heard."
homepage "https://github.com/mediar-ai/screenpipe"
url "https://github.com/mediar-ai/screenpipe/releases/download/v0.1.98/screenpipe-0.1.98-aarch64-apple-darwin.tar.gz"
version "0.1.98"
url "https://github.com/mediar-ai/screenpipe/releases/download/v0.1.99/screenpipe-0.1.99-aarch64-apple-darwin.tar.gz"
version "0.1.99"

on_macos do
if Hardware::CPU.arm?
url "https://github.com/mediar-ai/screenpipe/releases/download/v#{version}/screenpipe-#{version}-aarch64-apple-darwin.tar.gz"
sha256 "2cb4d60689ee22bf7c639e75cbcb57d3b8f21732fc383ff57592b4044b5e4396" # arm64
sha256 "new_sha256_value_for_arm64" # arm64
else
url "https://github.com/mediar-ai/screenpipe/releases/download/v#{version}/screenpipe-#{version}-x86_64-apple-darwin.tar.gz"
sha256 "969dad8fdbf79af2fa6ea14b604ac656041d8fa0281777b70bac6893d13bd34b" # x86_64
sha256 "new_sha256_value_for_x86_64" # x86_64
end
end

Expand Down Expand Up @@ -66,4 +66,4 @@ def install
# brew tap mediar-ai/screenpipe https://github.com/mediar-ai/screenpipe.git
# brew install screenpipe

# todo automate this in the future, not urgent for now ..
# todo automate this in the future, not urgent for now ..

0 comments on commit 62fba2b

Please sign in to comment.