-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: automatically release brew for both ARM and AMD builds
Brings the template into the garden repo so any changes to the process only need to go through here and will always be consistent.
- Loading branch information
Showing
2 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,29 +22,82 @@ permissions: | |
contents: read | ||
|
||
jobs: | ||
fetch-release-checksums: | ||
runs-on: ubuntu-latest | ||
env: | ||
ARM_TARBALL_URL: https://download.garden.io/core/${{ inputs.release-version }}/garden-${{ inputs.release-version }}-macos-arm64.tar.gz | ||
AMD_TARBALL_URL: https://download.garden.io/core/${{ inputs.release-version }}/garden-${{ inputs.release-version }}-macos-amd64.tar.gz | ||
outputs: | ||
arm-sha256: ${{ steps.fetch-arm-sha256.outputs.sha256 }} | ||
amd-sha256: ${{ steps.fetch-amd-sha256.outputs.sha256 }} | ||
arm-tarball-url: ${{ env.ARM_TARBALL_URL }} | ||
amd-tarball-url: ${{ env.AMD_TARBALL_URL }} | ||
steps: | ||
- name: Fetch arm sha256 | ||
id: fetch-arm-sha256 | ||
if: inputs.release-condition != 'false' | ||
run: | | ||
echo "sha256=$(curl -sSL ${{ env.ARM_TARBALL_URL }} | shasum -a 256 | cut -d ' ' -f 1)" >> "$GITHUB_OUTPUT" | ||
- name: Fetch amd sha256 | ||
id: fetch-amd-sha256 | ||
if: inputs.release-condition != 'false' | ||
run: | | ||
echo "sha256=$(curl -sSL ${{ env.AMD_TARBALL_URL }} | shasum -a 256 | cut -d ' ' -f 1)" >> "$GITHUB_OUTPUT" | ||
homebrew-create-pr: | ||
runs-on: macos-latest | ||
|
||
needs: fetch-release-checksums | ||
steps: | ||
- name: Checks release pre-condition | ||
if: inputs.release-condition == 'false' | ||
run: | | ||
echo The release-condition evaluated to false. | ||
echo Skipping all the next steps. | ||
- name: Create PR on Homebrew Formula repository | ||
- name: Checkout garden repo | ||
if: inputs.release-condition != 'false' | ||
uses: stefreak/bump-homebrew-formula-action@82352c3cbbc2acdec5a064502447b555f18496fc | ||
uses: actions/checkout@v4 | ||
with: | ||
tag-name: ${{ inputs.release-version }} | ||
formula-name: garden-cli | ||
formula-path: Formula/garden-cli.rb | ||
homebrew-tap: garden-io/homebrew-garden | ||
base-branch: main | ||
create-pullrequest: true | ||
download-url: https://download.garden.io/core/${{ inputs.release-version }}/garden-${{ inputs.release-version }}-macos-amd64.tar.gz | ||
repository: garden-io/garden | ||
ref: main | ||
path: garden | ||
token: ${{ secrets.COMMITTER_TOKEN }} | ||
|
||
- name: Checkout homebrew repo | ||
if: inputs.release-condition != 'false' | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: garden-io/homebrew-garden | ||
ref: main | ||
path: homebrew-garden | ||
token: ${{ secrets.COMMITTER_TOKEN }} | ||
|
||
- name: Template Homebrew Formula | ||
if: inputs.release-condition != 'false' | ||
uses: cuchi/[email protected] | ||
with: | ||
template: garden/support/homebrew-formula.rb.j2 | ||
output_file: homebrew-garden/Formula/garden-cli.rb | ||
strict: true | ||
variables: | | ||
version=${{ inputs.release-version }}} | ||
armTarballUrl=${{ needs.fetch-release-checksums.outputs.arm-tarball-url }} | ||
amdTarballUrl=${{ needs.fetch-release-checksums.outputs.amd-tarball-url }} | ||
armSha256=${{ needs.fetch-release-checksums.outputs.arm-sha256 }} | ||
amdSha256=${{ needs.fetch-release-checksums.outputs.amd-sha256 }} | ||
- name: Create PR on Homebrew Repository | ||
if: inputs.release-condition != 'false' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
path: homebrew-garden | ||
token: ${{ secrets.COMMITTER_TOKEN }} | ||
commit-message: ${{ inputs.commit-message }} | ||
env: | ||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} | ||
title: Bump garden-cli to ${{ inputs.release-version }} | ||
body: ${{ inputs.commit-message}} | ||
branch: garden-cli-${{ inputs.release-version }} | ||
reviewers: ${{ github.triggering_actor }} | ||
|
||
- name: Adding markdown summary | ||
if: inputs.release-condition != 'false' | ||
run: | | ||
|
12 changes: 10 additions & 2 deletions
12
support/homebrew-formula.rb → support/homebrew-formula.rb.j2
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