Skip to content

Commit

Permalink
Merge pull request #703 from carmal891/fix/homebrew-version-bumper
Browse files Browse the repository at this point in the history
Adds Github workflow to update homebrew formula in pvsadm tap repository on release
  • Loading branch information
Power Cloud Robot authored Nov 18, 2024
2 parents 149a34b + 2063d19 commit 4e2625f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/update-homebrew-formula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
- name: Update Homebrew formula
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
RELEASE_VERSION=${{ github.event.release.tag_name }}
Expand Down
11 changes: 4 additions & 7 deletions ci/brew_formula_updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ if [ "$#" -ne 4 ]; then
exit 1
fi

# Ensure GitHub token and GH CLI token are set
if [[ -z "$GITHUB_TOKEN" || -z "$GH_TOKEN" ]]; then
echo "Error: Required tokens are not set."
# Ensure GitHub app token is set
if [[ -z "$GH_TOKEN" ]]; then
echo "Error: Required token is not set."
exit 1
fi

Expand Down Expand Up @@ -146,16 +146,13 @@ fi
# Commit and push updated formula file to remote tap repository
git add "$FORMULA_FILE"
git commit -m "Update formula to version $NEW_VERSION"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@${BREW_TAP_REPO_URL#https://}
git remote set-url origin https://x-access-token:${GH_TOKEN}@${BREW_TAP_REPO_URL#https://}

if ! git push origin "$BRANCH_NAME"; then
echo "Error: Failed to push branch $BRANCH_NAME"
exit 1
fi

# Need to unset GITHUB_TOKEN for gh cli to use GH_TOKEN instead
unset GITHUB_TOKEN

# Create PR
if gh pr create --head "$BRANCH_NAME" \
--title "Updates formula to version $NEW_VERSION" \
Expand Down

0 comments on commit 4e2625f

Please sign in to comment.