Skip to content

Commit 04b4bbd

Browse files
author
Power Cloud Robot
authored
Merge pull request #699 from carmal891/fix/homebrew-version-bumper
Introduces Github workflow to update homebrew formula in pvsadm tap repository on release
2 parents 587a894 + 496a0cc commit 04b4bbd

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,3 @@ jobs:
156156
asset_path: pvsadm-binaries.tar.gz
157157
asset_name: pvsadm-binaries.tar.gz
158158
asset_content_type: application/tar+gzip
159-
160-
- name: Update Homebrew formula
161-
env:
162-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
163-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
164-
run: |
165-
git config --global user.name "pvsadm GitHub Actions"
166-
git config --global user.email "[email protected]"
167-
GET_VERSION_OUTPUT="${{ steps.get_version.outputs.VERSION }}"
168-
NEW_VERSION=${GET_VERSION_OUTPUT#v}
169-
BASE_REPO_URL="https://github.com/${GITHUB_REPOSITORY}"
170-
BREW_TAP_REPO_URL="https://github.com/ppc64le-cloud/homebrew-pvsadm"
171-
FORMULA_FILE="pvsadm.rb"
172-
./ci/brew_formula_updater.sh "$BASE_REPO_URL" "$NEW_VERSION" "$BREW_TAP_REPO_URL" "$FORMULA_FILE"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Update Homebrew Formula on Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update-homebrew:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Get GitHub App User ID and setup the git environment
16+
id: get-user-id
17+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
18+
env:
19+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
20+
- run: |
21+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
22+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
23+
24+
- name: Generate GitHub App Token
25+
uses: actions/create-github-app-token@v1
26+
id: app-token
27+
with:
28+
app-id: ${{ vars.APP_ID }}
29+
private-key: ${{ secrets.PRIVATE_KEY }}
30+
owner: ${{ github.repository_owner }}
31+
32+
- name: Update Homebrew formula
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
35+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
36+
run: |
37+
RELEASE_VERSION=${{ github.event.release.tag_name#v }}
38+
BASE_REPO_URL="https://github.com/${GITHUB_REPOSITORY}"
39+
BREW_TAP_REPO_URL="https://github.com/ppc64le-cloud/homebrew-pvsadm"
40+
FORMULA_FILE="pvsadm.rb"
41+
./ci/brew_formula_updater.sh "$BASE_REPO_URL" "$RELEASE_VERSION" "$BREW_TAP_REPO_URL" "$FORMULA_FILE"

0 commit comments

Comments
 (0)