Update Homebrew #46
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 | |
on: | |
workflow_dispatch: | |
jobs: | |
update-homebrew: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Release Version | |
uses: actions/github-script@v3 | |
id: get_release_version | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
result-encoding: string | |
script: | | |
const { data } = await github.repos.getRelease({ | |
owner: 'azure', | |
repo: 'bicep', | |
release_id: 'latest', | |
}); | |
return data.tag_name.substring(1); | |
- name: Get SHA256 checksum for x64 | |
id: get_release_sha256_x64 | |
run: | | |
set -euxo pipefail | |
result=$(curl -Lf https://github.com/Azure/bicep/releases/download/v${{ steps.get_release_version.outputs.result }}/bicep-osx-x64 | sha256sum | awk '{print $1}') | |
echo "::set-output name=result::$result" | |
- name: Get SHA256 checksum for arm64 | |
id: get_release_sha256_arm64 | |
run: | | |
set -euxo pipefail | |
result=$(curl -Lf https://github.com/Azure/bicep/releases/download/v${{ steps.get_release_version.outputs.result }}/bicep-osx-arm64 | sha256sum | awk '{print $1}') | |
echo "::set-output name=result::$result" | |
- name: Update the Homebrew formula | |
run: | | |
set -euxo pipefail | |
export release_version="${{ steps.get_release_version.outputs.result }}" | |
export release_sha256_x64="${{ steps.get_release_sha256_x64.outputs.result }}" | |
export release_sha256_arm64="${{ steps.get_release_sha256_arm64.outputs.result }}" | |
envsubst < ./.github/workflows/bicep.rb.tpl > ./Formula/bicep.rb | |
- name: Update update-homebrew branch | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update Homebrew to v${{ steps.get_release_version.outputs.result }} | |
branch: update-homebrew | |
- name: Shortcut for PR creation | |
run: echo "Use this link to create a PR -> https://github.com/Azure/homebrew-bicep/compare/main...update-homebrew" |