Skip to content

Commit 65b2295

Browse files
NarekmatHaarolean
andauthored
Implement a workflow to prepare helm charts release (#2950)
Co-authored-by: Roman Zabaluev <[email protected]>
1 parent ddc76ac commit 65b2295

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: prepare-helm-release
2+
on:
3+
repository_dispatch:
4+
types: [prepare-helm-release]
5+
jobs:
6+
change-app-version:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- run: |
11+
git config user.name github-actions
12+
git config user.email [email protected]
13+
- name: Change versions
14+
run: |
15+
git checkout -b release-${{ github.event.client_payload.appversion}}
16+
version=$(cat charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}')
17+
version=${version%.*}.$((${version##*.}+1))
18+
sed -i "s/version:.*/version: ${version}/" charts/kafka-ui/Chart.yaml
19+
sed -i "s/appVersion:.*/appVersion: ${{ github.event.client_payload.appversion}}/" charts/kafka-ui/Chart.yaml
20+
git add charts/kafka-ui/Chart.yaml
21+
git commit -m "release ${version}"
22+
git push --set-upstream origin release-${{ github.event.client_payload.appversion}}
23+
- name: Slack Notification
24+
uses: rtCamp/action-slack-notify@v2
25+
env:
26+
SLACK_TITLE: "release-${{ github.event.client_payload.appversion}}"
27+
SLACK_MESSAGE: "A new release of the helm chart has been prepared. Branch name: release-${{ github.event.client_payload.appversion}}"
28+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

.github/workflows/release.yaml

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,14 @@ jobs:
8787

8888
charts:
8989
runs-on: ubuntu-latest
90+
permissions:
91+
actions: write
9092
needs: release
9193
steps:
92-
- uses: actions/checkout@v3
94+
- name: Repository Dispatch
95+
uses: peter-evans/repository-dispatch@v2
9396
with:
94-
fetch-depth: 1
95-
96-
- run: |
97-
git config user.name github-actions
98-
git config user.email [email protected]
99-
100-
- uses: azure/setup-helm@v1
101-
102-
- name: update chart version
103-
run: |
104-
export version=${{needs.release.outputs.version}}
105-
sed -i "s/version:.*/version: ${version}/" charts/kafka-ui/Chart.yaml
106-
sed -i "s/appVersion:.*/appVersion: ${version}/" charts/kafka-ui/Chart.yaml
107-
108-
- name: add chart
109-
run: |
110-
export VERSION=${{needs.release.outputs.version}}
111-
MSG=$(helm package --app-version ${VERSION} charts/kafka-ui)
112-
git fetch origin
113-
git stash
114-
git checkout -b gh-pages origin/gh-pages
115-
helm repo index .
116-
git add -f ${MSG##*/} index.yaml
117-
git commit -m "release ${VERSION}"
118-
git push
97+
token: ${{ secrets.GITHUB_TOKEN }}
98+
repository: provectus/kafka-ui
99+
event-type: prepare-helm-release
100+
client-payload: '{"appversion": "${{ needs.release.outputs.version }}"}'

0 commit comments

Comments
 (0)