From d8a1282c688554ff9159e904269e0b5b879be952 Mon Sep 17 00:00:00 2001 From: Hunter Mellema <124718352+hpmellema@users.noreply.github.com> Date: Tue, 1 Aug 2023 13:38:51 -0600 Subject: [PATCH] Update brew workflow to use new smithy tap (#1897) 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. --- .github/workflows/update-brew.yml | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update-brew.yml b/.github/workflows/update-brew.yml index a0142f5958a..97c2e19f910 100644 --- a/.github/workflows/update-brew.yml +++ b/.github/workflows/update-brew.yml @@ -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 @@ -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 }}