File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 : Test helm chart packaging
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+ # an early check for correct tag saves waiting for the build to find problems
25+ - name : Check helm version tag
26+ if : ${{ github.ref_type == 'tag' }}
27+ env :
28+ VERSION : " ${{ github.ref_name }}"
29+ run : |
30+ set -xeuo pipefail
31+
32+ VERSION=${{ github.ref_name }}
33+
34+ # Check that alpha/beta versions have the form 2025.8.1+b1 requried by Helm
35+ if [[ "${VERSION}" =~ '^[0-9]+\.[0-9]+\.[0-9]+(\+.*)?$' ]]; then
36+ echo "Valid version format: ${VERSION}"
37+ else
38+ echo "Invalid version format: ${VERSION}. Expected format: X.Y.Z or X.Y.Z+string"
39+ return 1
40+ fi
41+
42+ - name : Package helm charts
43+ env :
44+ VERSION : " ${{ github.ref_type == 'tag' && github.ref_name || '0.0.0' }}"
45+ run : |
46+ set -xeuo pipefail
47+
48+ mkdir -p charts
49+ cd helm
50+ helm package -u --app-version ${VERSION} --version ${VERSION} .
51+ mv *.tgz ../../charts
52+
53+ - name : Upload helm charts as artifacts
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : charts
57+ path : charts
Original file line number Diff line number Diff line change 2020 rm -rf $GITHUB_REF_NAME
2121 fi
2222
23+ - name : Push tagged helm chart to registry
24+ run : |
25+ set -x
26+
27+ echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io/${{ github.repository_owner }} --username ${{ github.repository_owner }} --password-stdin
28+
29+ IFS='@' read -r NAME VERSION <<< "${GITHUB_REF_NAME}"
30+ REGISTRY=oci://ghcr.io/diamondlightsource
31+
32+ helm push "${NAME}-${VERSION}.tgz" ${REGISTRY}
33+
2334 - name : Create GitHub Release
2435 # We pin to the SHA, not the tag, for security reasons.
2536 # https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
Original file line number Diff line number Diff line change 5151 permissions :
5252 id-token : write
5353
54+ helm :
55+ uses : ./.github/workflows/_helm.yml
56+
5457 release :
5558 if : github.ref_type == 'tag'
56- needs : [dist, docs]
59+ needs : [dist, docs, helm ]
5760 uses : ./.github/workflows/_release.yml
5861 permissions :
5962 contents : write
Original file line number Diff line number Diff line change 1+ #! /bin/env bash
2+
3+ set -xeuo pipefail
4+
5+ FULL_REF=$( git describe --tags)
6+ VERSION=" ${FULL_REF#*@ } "
7+
8+ # Check that alpha/beta versions have the form 2025.8.1+b1 requried by Helm
9+ if [[ " ${VERSION} " =~ ' ^[0-9]+\.[0-9]+\.[0-9]+(\+.*)?$' ]]; then
10+ echo " Valid version format: ${VERSION} "
11+ else
12+ echo " Invalid version format: ${VERSION} . Expected format: X.Y.Z or X.Y.Z+string"
13+ return 1
14+ fi
15+
16+ mkdir -p charts
17+
18+ cd helm
19+
20+ helm package -u --app-version ${VERSION} --version ${VERSION} .
21+ mv * .tgz ../../charts
You can’t perform that action at this time.
0 commit comments