-
-
Notifications
You must be signed in to change notification settings - Fork 231
168 lines (146 loc) · 4.76 KB
/
publish-charts.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
name: Release Charts
on:
push:
paths:
- 'charts/**'
- '.github/workflows/publish-charts.yaml'
branches:
- master
jobs:
lint-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.5.4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
check-latest: true
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: |
ct lint --config ct.yaml
test-charts:
needs:
- lint-charts
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: kind
- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.5.4
- name: Install yq
run: |
sudo snap install yq
- name: Install and test Redis Related Helm charts
run: |
kubectl cluster-info --context kind-kind
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel")
for dir in "${chart_dirs[@]}"
do
if [[ -f ./charts/$dir/Chart.yaml ]]; then
helm dependency update ./charts/$dir/
fi
helm install $dir ./charts/$dir/
helm test $dir
done
echo "Listing installed Helm charts..."
release-charts:
runs-on: ubuntu-latest
needs:
- test-charts
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/redis-operator"
path: "redis-operator"
fetch-depth: 0
- name: Checkout helm-charts
uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/helm-charts"
# use token for helm-charts repo
token: "${{ secrets.HELM_CHARTER_TOKEN }}"
path: "helm-charts"
fetch-depth: 0
- name: Get chart version
run: |
echo "chart_version=$(echo ${GITHUB_REF##*/v})" >> $GITHUB_ENV
- name: Install Helm
uses: azure/setup-helm@v4
- name: Make charts
shell: bash
working-directory: redis-operator
run: |
helm repo add jetstack https://charts.jetstack.io
helm repo update
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel")
for dir in "${chart_dirs[@]}"
do
if [[ -f ./charts/$dir/Chart.yaml ]]; then
helm dependency update ./charts/$dir/
fi
helm package charts/$dir -d .cr-release-packages
done
- name: Install chart-releaser
uses: helm/[email protected]
with:
install_only: true
# upload charts to helm-charts repos's release
- name: Upload charts
shell: bash
working-directory: redis-operator
run: |
cr upload
env:
# GitHub repository
CR_GIT_REPO: "helm-charts"
# Path to directory with chart packages (default ".cr-release-packages")
CR_PACKAGE_PATH: ".cr-release-packages"
# use token for helm-charts repo
CR_TOKEN: "${{ secrets.HELM_CHARTER_TOKEN }}"
# owner
CR_OWNER: "${{ github.repository_owner }}"
# skip existing charts
CR_SKIP_EXISTING: "true"
# copy artifacts to helm-charts repo, we need those for update index
- name: Copy artifacts
run: |
cp -r redis-operator/.cr-release-packages helm-charts/
- name: Configure Git
working-directory: helm-charts
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# this step will directly push to the main branch, so make sure you have the right permissions
- name: Update index
working-directory: helm-charts
run: |
cr index --push
env:
# GitHub repository
CR_GIT_REPO: "helm-charts"
# The GitHub pages branch (default "gh-pages")
CR_PAGES_BRANCH: "gh-pages"
# Path to directory with chart packages (default ".cr-release-packages")
CR_PACKAGE_PATH: ".cr-release-packages"
# use token for helm-charts repo
CR_TOKEN: "${{ secrets.HELM_CHARTER_TOKEN }}"
# owner
CR_OWNER: "${{ github.repository_owner }}"
# index path
CR_INDEX_PATH: "index.yaml"