-
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (160 loc) · 5.16 KB
/
release.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
name: Release Helm chart and push
on:
push:
branches:
- main
permissions:
contents: write
packages: write
pages: write
id-token: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release-charts:
name: Release Charts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Fetch current Chart Index
run: |
git checkout origin/helm-index index.yaml
- name: Add Helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Remove readme images
run: |
set -x
for f in charts/**/README.md; do
sed -i '/^<img .* alt=".* logo"/,+1d' "$f"
done
- name: Install chart-releaser
uses: helm/[email protected]
with:
install_only: true
- name: Package charts
id: package_charts
run: |
changed_charts=""
for dir in charts/*; do
chart_name="$(basename "$dir")"
version="$(yq '.version' "$dir/Chart.yaml")"
if ! git rev-parse "$chart_name-${version#v}" &>/dev/null; then
echo "Packaging chart $chart_name..."
cr package --package-path=.cr-release-packages "$dir"
changed_charts+="$chart_name,"
fi
done
echo "changed_charts=${changed_charts%,}" >> $GITHUB_OUTPUT
# The GitHub repository secret `PGP_PRIVATE_KEY` contains the private key
# in ASCII-armored format. To export a (new) key, run this command:
# `gpg --armor --export-secret-key <my key>`
- name: Prepare PGP key
run: |
IFS=""
base64 -d <<< "$GPG_KEYRING_BASE64" > $HOME/secring.gpg
echo "$PGP_PASSPHRASE" > $HOME/passphrase.txt
# Tell chart-releaser-action where to find the key and its passphrase
echo "CR_KEYRING=$HOME/secring.gpg" >> "$GITHUB_ENV"
echo "CR_PASSPHRASE_FILE=$HOME/passphrase.txt" >> "$GITHUB_ENV"
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
PGP_PASSPHRASE: "${{ secrets.PGP_PASSPHRASE }}"
- name: Run chart-releaser
uses: helm/[email protected]
if: steps.package_charts.outputs.changed_charts != ''
with:
config: "./.github/configs/cr.yaml"
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_PAGES_BRANCH: helm-index
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: steps.package_charts.outputs.changed_charts != ''
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push chart to GHCR
if: steps.package_charts.outputs.changed_charts != ''
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*.tgz; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" oci://ghcr.io/${{ github.repository }}
done
build-docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
cache-dependency-path: docs/requirements.txt
- name: MkDocs cache
uses: actions/cache@v4
with:
path: docs/.cache
key: ${{ runner.os }}-mkdocs-${{ github.sha }}
restore-keys: |
${{ runner.os }}-mkdocs-
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Build docs
working-directory: docs
env:
REPO_NAME: ${{ github.repository }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
run: mkdocs build
- name: Compress
run: tar -czvf docs.tar.gz -C docs site
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: docs.tar.gz
deploy-site:
name: Deploy Site
runs-on: ubuntu-latest
needs: [release-charts, build-docs]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout Helm index
uses: actions/checkout@v4
with:
path: helm-index
ref: refs/heads/helm-index
- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: docs
- name: Decompress docs
run: tar -xzvf docs.tar.gz
- name: Move Helm index to docs
run: mv helm-index/* site
- name: Upload release artifact
uses: actions/upload-pages-artifact@v2
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3