Skip to content

Commit

Permalink
feat: add update to the brew file
Browse files Browse the repository at this point in the history
  • Loading branch information
benfdking committed Apr 27, 2024
1 parent d30a4fb commit 9341ef6
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,52 @@ jobs:
draft: true
files: |
sqruff-*
update-homebrew-formula:
name: Update Homebrew Formula
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
- name: Update Homebrew Formula
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
RELEASE_VERSION=${{ github.event.release.tag_name }}
STRIPPED_VERSION=${RELEASE_VERSION#v}
git clone https://${GITHUB_TOKEN}@github.com/quarylabs/homebrew-quary.git
cd homebrew-quary
sed -i "s/version \".*\"/version \"${STRIPPED_VERSION}\"/" sqruff.rb
for asset in ${{ steps.upload-release-asset.outputs.browser_download_urls }}; do
if [[ $asset == *"darwin-aarch64"* ]]; then
DARWIN_AARCH64_URL=$asset
DARWIN_AARCH64_SHA256=$(curl -sL $asset.sha256)
elif [[ $asset == *"darwin-x86_64"* ]]; then
DARWIN_X86_64_URL=$asset
DARWIN_X86_64_SHA256=$(curl -sL $asset.sha256)
elif [[ $asset == *"linux-x86_64-musl"* ]]; then
LINUX_X86_64_URL=$asset
LINUX_X86_64_SHA256=$(curl -sL $asset.sha256)
fi
done
sed -i "s|url \".*\"|url \"${DARWIN_AARCH64_URL}\"|" sqruff.rb
sed -i "s/sha256 \".*\"/sha256 \"${DARWIN_AARCH64_SHA256}\"/" sqruff.rb
sed -i "s|url \".*\"|url \"${DARWIN_X86_64_URL}\"|" sqruff.rb
sed -i "s/sha256 \".*\"/sha256 \"${DARWIN_X86_64_SHA256}\"/" sqruff.rb
sed -i "s|url \".*\"|url \"${LINUX_X86_64_URL}\"|" sqruff.rb
sed -i "s/sha256 \".*\"/sha256 \"${LINUX_X86_64_SHA256}\"/" sqruff.rb
git add sqruff.rb
git commit -m "Update Sqruff to version ${STRIPPED_VERSION}"
git push
gh pr create --title "Update Sqruff to version ${STRIPPED_VERSION}" --body "Automated PR to update Sqruff to version ${STRIPPED_VERSION}" --base main

0 comments on commit 9341ef6

Please sign in to comment.