Skip to content

Commit 36c6a12

Browse files
committed
Added step to update brew formula on release
1 parent a64f7c2 commit 36c6a12

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/release.yml

+32
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,35 @@ jobs:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545
with:
4646
args: './k8s-parallel-exec-*'
47+
48+
- name: Checkout Homebrew tap repository
49+
uses: actions/checkout@v2
50+
with:
51+
repository: cin/homebrew-k8s-parallel-exec
52+
53+
- name: Update Homebrew formula
54+
run: |
55+
FORMULA_FILE="k8s-parallel-exec.rb"
56+
NEW_VERSION="${{ github.event.release.tag_name }}"
57+
sed -i "s|version \"[^\"]*\"|version \"${NEW_VERSION}\"|g" "${FORMULA_FILE}"
58+
59+
function update_sha {
60+
local new_sha=$(sha256sum $1 | awk '{print $1}')
61+
gawk -i inplace -v platform="$1" -v new_sha="$new_sha" '
62+
index($0, platform) {
63+
print; getline; sub(/sha256 ".*"/, "sha256 \"" new_sha "\"");
64+
}1' "${FORMULA_FILE}"
65+
}
66+
67+
update_sha k8s-parallel-exec-linux-amd64
68+
update_sha k8s-parallel-exec-linux-arm64
69+
update_sha k8s-parallel-exec-darwin-amd64
70+
update_sha k8s-parallel-exec-darwin-arm64
71+
72+
- name: Commit and push changes
73+
run: |
74+
git config --local user.email "[email protected]"
75+
git config --local user.name "GitHub Action"
76+
git add "k8s-parallel-exec.rb"
77+
git commit -m "Update k8s-parallel-exec to ${{ github.event.release.tag_name }}"
78+
git push

0 commit comments

Comments
 (0)