Skip to content

Commit 1652142

Browse files
add workflow files
1 parent 5a15d4b commit 1652142

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
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 github-actions@github.com
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/helm.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Helm linter
2+
on:
3+
pull_request:
4+
types: ["opened", "edited", "reopened", "synchronize"]
5+
branches:
6+
- 'master'
7+
paths:
8+
- "charts/**"
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Helm tool installer
15+
uses: Azure/setup-helm@v3
16+
- name: Setup Kubeval
17+
uses: lra/setup-kubeval@v1.0.1
18+
#check, was helm version increased in Chart.yaml?
19+
- name: Check version
20+
shell: bash
21+
run: |
22+
helm_version_new=$(cat charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}')
23+
helm_version_old=$(curl -s https://raw.githubusercontent.com/provectus/kafka-ui-charts/main/charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}' )
24+
echo $helm_version_old
25+
echo $helm_version_new
26+
if [[ "$helm_version_new" > "$helm_version_old" ]]; then exit 0 ; else exit 1 ; fi
27+
- name: Run kubeval
28+
shell: bash
29+
run: |
30+
sed -i "s@enabled: false@enabled: true@g" charts/kafka-ui/values.yaml
31+
K8S_VERSIONS=$(git ls-remote --refs --tags https://github.com/kubernetes/kubernetes.git | cut -d/ -f3 | grep -e '^v1\.[0-9]\{2\}\.[0]\{1,2\}$' | grep -v -e '^v1\.1[0-7]\{1\}' | cut -c2-)
32+
echo "NEXT K8S VERSIONS ARE GOING TO BE TESTED: $K8S_VERSIONS"
33+
echo ""
34+
for version in $K8S_VERSIONS
35+
do
36+
echo $version;
37+
helm template --kube-version $version --set ingress.enabled=true charts/kafka-ui -f charts/kafka-ui/values.yaml | kubeval --additional-schema-locations https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master --strict -v $version;
38+
done
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release helm
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "charts/**"
8+
9+
jobs:
10+
release-helm:
11+
runs-on:
12+
ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 1
17+
18+
- run: |
19+
git config user.name github-actions
20+
git config user.email github-actions@github.com
21+
22+
- uses: azure/setup-helm@v3
23+
24+
- name: add chart #realse helm with new version
25+
run: |
26+
VERSION=$(cat charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}')
27+
echo "HELM_VERSION=$(echo ${VERSION})" >> $GITHUB_ENV
28+
MSG=$(helm package charts/kafka-ui)
29+
git fetch origin
30+
git stash
31+
git checkout -b gh-pages origin/gh-pages
32+
git pull
33+
helm repo index .
34+
git add -f ${MSG##*/} index.yaml
35+
git commit -m "release ${VERSION}"
36+
git push
37+
- uses: rickstaa/action-create-tag@v1 #create new tag
38+
with:
39+
tag: "charts/kafka-ui-${{ env.HELM_VERSION }}"

0 commit comments

Comments
 (0)