Skip to content

Commit

Permalink
Update brew workflow to use new smithy tap (smithy-lang#1897)
Browse files Browse the repository at this point in the history
Updates the cli brew update workflow to use the new smithy-lang tap instead of aws/tap. 
The workflow is also updated to avoid the need for maintaining a repository fork and to use the github cli directly for creating a pull request.
  • Loading branch information
hpmellema committed Aug 1, 2023
1 parent 1692463 commit d8a1282
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions .github/workflows/update-brew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Checkout bottle repo
uses: actions/checkout@v3
with:
repository: 'aws/homebrew-tap'
repository: 'smithy-lang/homebrew-tap'
path: 'homebrew-tap'
ref: 'master'
- name: Update version
Expand Down Expand Up @@ -97,26 +97,20 @@ jobs:
sha=$(cut -d " " -f1 ${{steps.download.outputs.download-path}}/smithy-cli-linux-aarch64.tar.gz.sha256)
tmp=$(mktemp)
jq --arg sha "$sha" '.bottle.sha256.linux_arm = "'$sha'"' homebrew-tap/bottle-configs/smithy-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/smithy-cli.json
- name: Create commits
- name: Set up new git branch for version bump
run: |
cd homebrew-tap
git config user.name 'smithy-automation'
git config user.email 'github-smithy-automation@amazon.com'
git checkout -b "automation/bump-smithy-cli-version/${GITHUB_REF##*/}"
- name: Create PR
run: |
git add bottle-configs/smithy-cli.json
git commit -m "chore: upgrade smithy-cli to ${GITHUB_REF##*/}"
- name: Set pull-request variables
id: vars
run: |
echo version="${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
echo pr_title="chore: upgrade smithy-cli to ${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
echo pr_body="Created by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> $GITHUB_OUTPUT
- name: Create pull-request
uses: peter-evans/create-pull-request@v5
with:
path: homebrew-tap
delete-branch: true
push-to-fork: smithy-automation/homebrew-tap
title: ${{ steps.vars.outputs.pr_title }}
body: ${{ steps.vars.outputs.pr_body }}
branch: "upgrade-smithy-cli-${{ steps.vars.outputs.version }}"
token: ${{ secrets.PR_TOKEN }}
git push --set-upstream origin "automation/bump-smithy-cli-version/${GITHUB_REF##*/}"
gh pr create \
--title "[Automation] chore: upgrade smithy-cli to ${GITHUB_REF##*/}" \
--body "Created by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
--base main
env:
GITHUB_TOKEN: ${{ secrets.PR_TOKEN }}

0 comments on commit d8a1282

Please sign in to comment.