Skip to content

Commit 0655dfb

Browse files
authored
Merge 09f7c18 into 9f83ff4
2 parents 9f83ff4 + 09f7c18 commit 0655dfb

55 files changed

Lines changed: 4475 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/eval.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /bin/bash
2+
3+
CHARTS=$(pwd)/charts/*
4+
RETURN_VAL=0
5+
for chart in $CHARTS
6+
do
7+
./bin/helm dependency build ${chart}
8+
./bin/helm template ${chart} | kubeconform -strict
9+
10+
ret=$?
11+
if [ $ret -ne 0 ]; then
12+
RETURN_VAL=$ret
13+
fi
14+
done
15+
16+
if [ $RETURN_VAL -eq 0 ]; then
17+
echo "Chart evaluation successful !!!"
18+
fi
19+
20+
exit $RETURN_VAL

.github/scripts/lint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
3+
CHARTS=./charts/*
4+
for chart in $CHARTS
5+
do
6+
docker run --rm -v $(pwd):/apps alpine/helm:3 lint $chart
7+
done

.github/workflows/check.yaml

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: Check PR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
10+
- unlabeled
11+
branches:
12+
- master
13+
14+
jobs:
15+
16+
lint:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Lint
23+
run: ./.github/scripts/lint.sh
24+
25+
eval:
26+
runs-on: ubuntu-latest
27+
needs:
28+
- lint
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
- uses: azure/setup-helm@v4.3.0
33+
- uses: bmuschko/setup-kubeconform@v1
34+
35+
- name: Eval
36+
run: |
37+
.github/scripts/eval.sh
38+
39+
check-labels:
40+
runs-on: ubuntu-latest
41+
needs:
42+
- lint
43+
- eval
44+
45+
steps:
46+
- uses: actions/checkout@v2
47+
48+
- uses: actions/setup-java@v1
49+
with:
50+
java-version: '11'
51+
java-package: jdk
52+
53+
- id: match-label
54+
name: Match semver labels
55+
uses: zwaldowski/match-label-action@v1
56+
with:
57+
allowed: major, minor, patch
58+
59+
- uses: zwaldowski/semver-release-action@v2
60+
name: Semver release
61+
with:
62+
dry_run: true
63+
bump: ${{ steps.match-label.outputs.match }}
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
65+
66+
comment:
67+
runs-on: ubuntu-latest
68+
needs:
69+
- "check-labels"
70+
71+
if: always()
72+
steps:
73+
- uses: technote-space/workflow-conclusion-action@v2
74+
- name: Checkout
75+
uses: actions/checkout@v1
76+
77+
- name: Comment PR
78+
if: env.WORKFLOW_CONCLUSION == 'failure'
79+
uses: thollander/actions-comment-pull-request@1.0.2
80+
with:
81+
message: "Please apply one of the following labels to the PR: 'patch', 'minor', 'major'."
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
84+
prepare-release:
85+
needs: ["check-labels", "comment"]
86+
87+
runs-on: ubuntu-latest
88+
89+
steps:
90+
- uses: actions/checkout@v3
91+
with:
92+
fetch-depth: 0
93+
94+
- id: bump
95+
uses: zwaldowski/match-label-action@v4
96+
with:
97+
allowed: major,minor,patch
98+
99+
- name: Get changed files
100+
id: changed-files
101+
uses: tj-actions/changed-files@v14.6
102+
103+
104+
# prepare yaml parser
105+
- uses: actions/setup-go@v4
106+
- name: Install yq
107+
run: |
108+
go install github.com/mikefarah/yq/v4@latest
109+
yq --version
110+
111+
- uses: actions/checkout@v3
112+
with:
113+
ref: ${{ github.head_ref }}
114+
path: current-branch
115+
116+
- uses: actions/checkout@v3
117+
with:
118+
ref: 'master'
119+
path: master
120+
121+
- name: Update versions
122+
shell: bash
123+
run: |
124+
declare -A changedCharts
125+
126+
for file in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
127+
128+
echo "$file was changed"
129+
baseFolder=$(cut -d'/' -f1 <<< "$file")
130+
if [ $baseFolder = "charts" ] && [ $file != "charts/README.md" ]; then
131+
chartName=$(cut -d'/' -f2 <<< "$file")
132+
changedCharts[$chartName]=$chartName
133+
fi
134+
done
135+
136+
for c in "${changedCharts[@]}"; do
137+
# get version from chart yaml
138+
version=$(yq e '.version' "master/charts/$c/Chart.yaml")
139+
major=$(cut -d'.' -f1 <<< "$version")
140+
minor=$(cut -d'.' -f2 <<< "$version")
141+
patch=$(cut -d'.' -f3 <<< "$version")
142+
143+
prType=${{ steps.bump.outputs.match }}
144+
echo Update version $version with type $prType
145+
if [ $prType = "major" ]; then
146+
echo Update major
147+
major=$((major+1))
148+
minor=0
149+
patch=0
150+
elif [ $prType = "minor" ]; then
151+
echo Update minor
152+
minor=$((minor+1))
153+
patch=0
154+
elif [ $prType = "patch" ]; then
155+
echo Update patch
156+
patch=$((patch+1))
157+
fi
158+
echo Update version to $major.$minor.$patch for $c
159+
yq e -i '.version = "'$major.$minor.$patch'"' current-branch/charts/$c/Chart.yaml
160+
done
161+
162+
- name: Commit files
163+
continue-on-error: true
164+
run: |
165+
cd current-branch
166+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
167+
git config --local user.name "github-actions[bot]"
168+
git status
169+
echo commit
170+
git commit -m "Update helm chart versions" -a
171+
echo status update
172+
git status
173+
174+
- name: Push changes
175+
continue-on-error: true
176+
uses: ad-m/github-push-action@master
177+
with:
178+
directory: current-branch
179+
branch: ${{ github.head_ref }}

.github/workflows/pre-release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Pre-Release
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
10+
- unlabeled
11+
12+
jobs:
13+
14+
generate-version:
15+
name: Generate version
16+
runs-on: ubuntu-latest
17+
18+
outputs:
19+
version: ${{ steps.out.outputs.version }}
20+
plain-version: ${{ steps.out.outputs.plain-version }}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- id: bump
26+
uses: zwaldowski/match-label-action@v1
27+
with:
28+
allowed: major,minor,patch
29+
30+
- uses: zwaldowski/semver-release-action@v2
31+
with:
32+
dry_run: true
33+
bump: ${{ steps.bump.outputs.match }}
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Get PR Number
37+
id: pr_number
38+
run: echo "::set-output name=nr::$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')"
39+
40+
- name: Set version output
41+
id: out
42+
run: |
43+
echo "::set-output name=version::$(echo ${VERSION}-PRE-${{ steps.pr_number.outputs.nr }})"
44+
echo "::set-output name=plain-version::$(echo ${VERSION})"
45+
46+
47+
git-release:
48+
needs: ["generate-version"]
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
53+
- uses: actions/checkout@v2
54+
55+
- name: Generate Table of contents
56+
uses: technote-space/toc-generator@v4
57+
with:
58+
TARGET_PATHS: "./README.md,./doc/README.md"
59+
COMMIT_MESSAGE: "Update ToC"
60+
61+
- uses: "marvinpinto/action-automatic-releases@latest"
62+
with:
63+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
64+
automatic_release_tag: ${{ needs.generate-version.outputs.version }}
65+
prerelease: true
66+
title: ${{ needs.generate-version.outputs.version }}

.github/workflows/release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
10+
generate-version:
11+
name: "Generate version"
12+
runs-on: ubuntu-latest
13+
14+
outputs:
15+
version: ${{ steps.out.outputs.version }}
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- uses: actions/setup-java@v1
21+
with:
22+
java-version: '17'
23+
java-package: jdk
24+
25+
- id: pr
26+
uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Match semver label via bash
31+
id: match-label-bash
32+
run: |
33+
LABELS=$(cat <<-END
34+
${{ steps.pr.outputs.labels }}
35+
END
36+
)
37+
IFS='\n' read -ra LABEL <<< "$LABELS"
38+
for i in "${LABEL[@]}"; do
39+
echo $i
40+
case $i in
41+
# Will just use the first occurence
42+
'major'|'minor'|'patch')
43+
echo "RELEASE_LABEL=$i" >> $GITHUB_OUTPUT
44+
break
45+
esac
46+
done
47+
48+
- uses: zwaldowski/semver-release-action@v2
49+
with:
50+
dry_run: true
51+
bump: minor
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Set version output
55+
id: out
56+
run: echo "::set-output name=version::$(echo ${VERSION})"
57+
58+
deploy:
59+
name: "Release charts"
60+
needs:
61+
- "generate-version"
62+
runs-on: ubuntu-latest
63+
64+
steps:
65+
- uses: actions/checkout@v2
66+
67+
- name: Fetch history
68+
run: git fetch --prune --unshallow
69+
70+
- name: Configure Git
71+
run: |
72+
git config user.name "$GITHUB_ACTOR"
73+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
74+
75+
- name: Install Helm
76+
run: |
77+
curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
78+
chmod 700 get_helm.sh
79+
./get_helm.sh
80+
81+
- name: Add repositories
82+
run: |
83+
for dir in $(ls -d charts/*/); do
84+
helm dependency list $dir 2> /dev/null | tail +2 | sed '$d' | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done
85+
done
86+
87+
- name: Run chart-releaser
88+
uses: helm/chart-releaser-action@v1.5.0
89+
env:
90+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
91+
CR_SKIP_EXISTING: true
92+
93+
git-release:
94+
name: "Create Git Release"
95+
needs: ["generate-version", "deploy"]
96+
runs-on: ubuntu-latest
97+
98+
steps:
99+
100+
- uses: actions/checkout@v2
101+
102+
- name: Generate Table of contents
103+
uses: technote-space/toc-generator@v4
104+
with:
105+
TARGET_PATHS: "./README.md,./doc/README.md"
106+
COMMIT_MESSAGE: "Update ToC"

0 commit comments

Comments
 (0)