-
Notifications
You must be signed in to change notification settings - Fork 4
232 lines (200 loc) · 6.1 KB
/
main.yaml
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Main 🚀
on:
workflow_run:
workflows: ["bump"]
types:
- completed
jobs:
env:
uses: devxp-tech/.github/.github/workflows/env.yaml@main
lint-chart:
name: Chart Lint 🔎
runs-on: ubuntu-latest
needs:
- env
steps:
- name: Checkout Lint 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python 🐍
uses: actions/setup-python@v5
with:
python-version: '3.10'
check-latest: true
- name: Set up chart-testing 🔎
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
kubeval-chart:
name: Chart Validator 🔎
runs-on: ubuntu-latest
needs:
- env
strategy:
matrix:
k8s:
- v1.16.8
- v1.17.4
- v1.20.15
- v1.21.13
- v1.22.10
steps:
- name: Checkout Kubeval 🛎️
uses: actions/checkout@v4
- name: Run kubeval 🔎
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
run: .github/kubeval.sh
# quality-gate:
# uses: devxp-tech/.github/.github/workflows/sonarqube.yaml@main
# secrets: inherit
# needs:
# - env
release:
name: Chart Release ✨
needs:
- lint-chart
# - quality-gate
- kubeval-chart
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Git setup 🔧
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- name: Generate Helm Docs 📝
uses: docker://jnorwood/helm-docs:latest
with:
entrypoint: /usr/bin/helm-docs
args: --chart-search-root /github/workspace
- name: Run chart-releaser 📈
uses: helm/chart-releaser-action@main
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
CR_SKIP_EXISTING: true
- name: Commit Changes
id: docs_updater
uses: stefanzweifel/[email protected]
with:
commit_message: ":robot: Update Docs"
repository: .
artifacts:
name: Generate Artifacts 📦
runs-on: ubuntu-latest
needs:
- release
steps:
- name: Checkout Artifacts 🛎️
uses: actions/checkout@v4
with:
ref: artifacts
- name: Git setup 🔧
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- name: Download artifacts 📦
run: |
gh release list | awk '{print$1}' | while read line; do gh release download $line || true; done
if [[ $(git status -s) ]]; then
git add .
git commit -m ":robot: [github actions actor] update artifact list"
git push
else
echo "nothing to commit!!!"
fi
- name: Install Helm ☸️
uses: azure/setup-helm@v4
with:
version: v3.8.1
- name: Generate updated index.yaml 📦
run: |
helm repo index . --url "https://raw.githubusercontent.com/devxp-tech/helm-charts/artifacts/"
- name: Persist index.yaml 📦
uses: actions/upload-artifact@v4
with:
name: gh-pages
path: ./index.yaml
if-no-files-found: error
index:
name: Index Update 📝
runs-on: ubuntu-latest
needs:
- artifacts
steps:
- name: Chekcout 🛎️
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 1
- name: Git setup 🔧
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- uses: actions/download-artifact@v4
with:
name: gh-pages
- name: Commit New index.yaml 📝
run: |
if [[ $(git diff) ]];
then
git add index.yaml
git commit -m "[ci skip] :robot: [github actions actor] - update index.yaml"
git push
else
echo "nothing to do!!!"
fi
# changelog:
# name: Update Changelog 📝
# runs-on: ubuntu-latest
# needs:
# - index
# steps:
# - name: Checkout 🛎️ # Required to mount the Github Workspace to a volume
# uses: actions/checkout@v4
# - name: Docker Run 🐳
# uses: addnab/docker-run-action@v3
# with:
# image: mogensen/helm-changelog:latest
# options: -v ${{ github.workspace }}:/data
# run: "/app/helm-changelog"
# - name: Commit New Changelog.md 📝
# run: |
# if [[ $(git diff) ]];
# then
# git add Changelog.md
# git commit -m "[ci skip] :robot: [github actions actor] - Add Changelog.md"
# git push
# else
# echo "nothing to do!!!"
# fi
notify:
uses: devxp-tech/.github/.github/workflows/notify.yaml@main
if: always()
secrets: inherit
needs:
- index
# - changelog