Skip to content

Commit

Permalink
Added step to update brew formula on release
Browse files Browse the repository at this point in the history
  • Loading branch information
cin committed Mar 24, 2023
1 parent a64f7c2 commit 36c6a12
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,35 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: './k8s-parallel-exec-*'

- name: Checkout Homebrew tap repository
uses: actions/checkout@v2
with:
repository: cin/homebrew-k8s-parallel-exec

- name: Update Homebrew formula
run: |
FORMULA_FILE="k8s-parallel-exec.rb"
NEW_VERSION="${{ github.event.release.tag_name }}"
sed -i "s|version \"[^\"]*\"|version \"${NEW_VERSION}\"|g" "${FORMULA_FILE}"
function update_sha {
local new_sha=$(sha256sum $1 | awk '{print $1}')
gawk -i inplace -v platform="$1" -v new_sha="$new_sha" '
index($0, platform) {
print; getline; sub(/sha256 ".*"/, "sha256 \"" new_sha "\"");
}1' "${FORMULA_FILE}"
}
update_sha k8s-parallel-exec-linux-amd64
update_sha k8s-parallel-exec-linux-arm64
update_sha k8s-parallel-exec-darwin-amd64
update_sha k8s-parallel-exec-darwin-arm64
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add "k8s-parallel-exec.rb"
git commit -m "Update k8s-parallel-exec to ${{ github.event.release.tag_name }}"
git push

0 comments on commit 36c6a12

Please sign in to comment.