-
Notifications
You must be signed in to change notification settings - Fork 31
148 lines (118 loc) · 3.6 KB
/
check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Chart Test
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
branches:
- main
jobs:
# lint the charts
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint
run: ./lint.sh
eval:
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/checkout@v2
- name: Eval
run: |
.github/build/install.sh
./eval.sh
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk
- id: bump
uses: zwaldowski/match-label-action@v1
with:
allowed: major,minor,patch
prepare-release:
needs: ["check"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: bump
uses: zwaldowski/match-label-action@v4
with:
allowed: major,minor,patch
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v14.6
# prepare yaml parser
- uses: actions/setup-go@v4
- name: Install yq
run: |
go install github.com/mikefarah/yq/v4@latest
yq --version
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Update versions
shell: bash
run: |
declare -A changedCharts
for file in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
echo "$file was changed"
baseFolder=$(cut -d'/' -f1 <<< "$file")
if [ $baseFolder = "charts" ]; then
chartName=$(cut -d'/' -f2 <<< "$file")
changedCharts[$chartName]=$chartName
fi
done
for c in "${changedCharts[@]}"; do
# get version from chart yaml
version=$(yq e '.version' "charts/$c/Chart.yaml")
major=$(cut -d'.' -f1 <<< "$version")
minor=$(cut -d'.' -f2 <<< "$version")
patch=$(cut -d'.' -f3 <<< "$version")
prType=${{ steps.bump.outputs.match }}
echo Update version $version with type $prType
if [ $prType = "major" ]; then
echo Update major
major=$((major+1))
minor=0
patch=0
elif [ $prType = "minor" ]; then
echo Update minor
minor=$((minor+1))
patch=0
elif [ $prType = "patch" ]; then
echo Update patch
patch=$((patch+1))
fi
echo Update version to $major.$minor.$patch for $c
yq e -i '.version = "'$major.$minor.$patch'"' charts/$c/Chart.yaml
done
- name: generate docs
run:
docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest
- name: Commit files
continue-on-error: true
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git status
echo commit
git commit -m "Update helm documentation" -a
echo status update
git status
- name: Push changes
continue-on-error: true
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}