Skip to content

Commit d2ede25

Browse files
committed
add helm CI
1 parent bee2e4b commit d2ede25

File tree

4 files changed

+79
-146
lines changed

4 files changed

+79
-146
lines changed

.github/workflows/_helm.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Package helm charts
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
HELM_VERSION_TO_INSTALL: 3.14.3
8+
9+
jobs:
10+
package-helm-charts:
11+
name: Package and Push Helm Chart
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install helm
20+
uses: Azure/setup-helm@v3
21+
with:
22+
version: ${{ env.HELM_VERSION_TO_INSTALL }}
23+
24+
# Check that alpha/beta versions have the form X.Y.Z-alpha.A requried by Helm.
25+
# An early check saves waiting for the entire build before finding a problem.
26+
- name: Check helm version tag
27+
if: ${{ github.ref_type == 'tag' }}
28+
env:
29+
VERSION: "${{ github.ref_name }}"
30+
run: |
31+
if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha|-beta|-rc).*?$ ]]; then
32+
echo "Valid version format: ${VERSION}"
33+
else
34+
echo "Invalid version: ${VERSION}. Expected: X.Y.Z or X.Y.Z-beta.1 or X.Y.Z-alpha.1"
35+
exit 1
36+
fi
37+
38+
- name: Package helm charts
39+
env:
40+
VERSION: "${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}"
41+
run: |
42+
set -xe
43+
44+
mkdir -p charts
45+
for i in $(find Charts -type d -maxdepth 1 -mindepth 1); do
46+
if [[ ${i} =~ ^.*-ioc$ ]]; then
47+
echo "Skipping IOC schema chart: ${i}"
48+
continue
49+
fi
50+
echo "Packaging chart: ${i}"
51+
helm package -u --app-version ${VERSION} --version ${VERSION} ${i}
52+
mv $(basename ${i})-*.tgz charts/
53+
done
54+
55+
- name: Upload helm chart values schemas
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: helm-chart-schemas
59+
path: schemas/*
60+
61+
- name: Push tagged helm chart to registry
62+
# TODO - switch to using https://github.com/helm/chart-releaser-action of maybe the docker action?
63+
if: ${{ github.ref_type == 'tag' }}
64+
run: |
65+
set -x
66+
67+
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io/${{ github.repository_owner }} --username ${{ github.repository_owner }} --password-stdin
68+
REGISTRY=oci://ghcr.io/${{github.repository_owner }}/charts
69+
for i in charts/*.tgz; do
70+
helm push "${i}" ${REGISTRY,,}
71+
done

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
tox: pre-commit,type-checking
1616

1717
container:
18-
needs: test
18+
needs: helm
1919
if: always()
2020
uses: ./.github/workflows/_container.yml
2121
with:
@@ -27,8 +27,14 @@ jobs:
2727
docs:
2828
uses: ./.github/workflows/_docs.yml
2929

30+
helm:
31+
uses: ./.github/workflows/_helm.yml
32+
permissions:
33+
contents: read
34+
packages: write
35+
3036
release:
31-
needs: [dist, test, docs]
37+
needs: [container, docs, helm]
3238
if: github.ref_type == 'tag'
3339
uses: ./.github/workflows/_release.yml
3440
permissions:

.github/workflows/code.yml

Lines changed: 0 additions & 81 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)