-
Notifications
You must be signed in to change notification settings - Fork 15
124 lines (104 loc) · 3.55 KB
/
helm.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
name: Helm
on:
push:
branches:
- "main"
paths:
- "charts/**"
pull_request:
branches:
- "main"
paths:
- "charts/**"
jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/setup-helm@v3.3
with:
version: "v3.5.0"
id: install
- name: Install tools
run: |
sudo snap install yq
- name: Build dependencies
run: helm dep update charts/substra-backend
- name: Lint Chart
run: helm lint charts/substra-backend
- name: Validate version increment
run: |
helm repo add substra https://substra.github.io/charts/connect-backend
RES=$(helm search repo substra/substra-backend --version $(yq eval .version charts/substra-backend/Chart.yaml))
if [ "${RES}" == "No results found" ]; then
echo "Version incremented"
else
echo "Validation failed, you should upgrade the chart version in Chart.yaml"
exit 1
fi
generate-chart-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout bitnami-labs/readme-generator-for-helm
uses: actions/checkout@v3
with:
repository: 'bitnami-labs/readme-generator-for-helm'
ref: '3300343a6cd1c9cd86d13b04d8c85a7415cb849e' # There is no release on the repo so we target an arbitrary commit
path: readme-generator-for-helm
- name: Install readme-generator-for-helm dependencies
run: cd readme-generator-for-helm && npm install
- uses: actions/checkout@v3
with:
path: backend
- name: Execute readme-generator-for-helm
run: readme-generator-for-helm/bin/index.js -r backend/charts/substra-backend/README.md -v backend/charts/substra-backend/values.yaml
- name: Check diff
run: |
cd backend/
if [ -z "$(git status --porcelain)" ]; then
exit 0
else
echo "There should be no change generated, please run 'make chart-doc' to update the chart README.md"
git diff
exit 1
fi
publish:
name: Publish
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs:
- test
- generate-chart-readme
steps:
- uses: actions/checkout@v3
- uses: azure/setup-helm@v3.3
with:
version: "v3.5.0"
id: install
- name: Add dependencies repo
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add std-helm https://charts.helm.sh/stable
helm repo add twuni https://helm.twun.io
- name: Package chart
run: |
helm dep build charts/substra-backend
helm package charts/substra-backend
- name: Clone Substra charts
uses: actions/checkout@v3
with:
repository: Substra/charts
ref: 'main'
token: ${{ secrets.CHARTS_GITHUB_TOKEN }}
path: substra-charts
- name: Publish chart
run: |
mv substra-backend-$(grep -e "^version" charts/substra-backend/Chart.yaml | cut -c10-).tgz substra-charts/
cd substra-charts
helm repo index .
git add .
git config --global user.email "gh-actions@github.com"
git config --global user.name "GitHub Action"
git commit -s --message "GitHub Action: ${{ github.repository }}@${{ github.sha }}"
git push --quiet --set-upstream origin main