1- name : Release Helm Chart and Carvel package
1+ name : Release Helm Chart
22
33on :
44 push :
99 - main
1010
1111jobs :
12- release :
12+ chart- release :
1313 runs-on : ubuntu-latest
14+ env :
15+ CHART_BASE_DIR : helm
16+ GH_PAGES_BRANCH : gh-pages
17+ permissions :
18+ contents : write
19+ pages : write
1420 steps :
15- - name : Checkout
16- uses : actions/checkout@v3.1.0
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
1723 with :
1824 fetch-depth : 0
1925
20- - name : Configure Git
26+ - name : Set ENVs
27+ id : env-setup
2128 run : |
29+ echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
2230 git config user.name "$GITHUB_ACTOR"
2331 git config user.email "[email protected] " 2432
25- - name : Install Helm
26- 27- with :
28- version : v3.4.2
33+ - name : Package Charts
34+ run : |
35+ # Package charts
36+ mkdir -p charts/.ci-build
37+ echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"
38+
39+ for DIR in $CHART_BASE_DIR/*; do
40+ # Check if Chart.yaml exists in this directory
41+ if [ -f "${DIR}/Chart.yaml" ]; then
42+ echo "Packaging ${DIR}"
43+ helm dependency update $DIR
44+ helm lint $DIR
45+ helm package $DIR --destination charts/.ci-build
46+ fi
47+ done
48+ git fetch --all
2949
30- - name : Run chart-releaser
31- 50+ - name : Upload chart artifacts
51+ uses : actions/upload-artifact@v4
3252 with :
33- charts_dir : helm
34- env :
35- CR_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
36- CR_RELEASE_NAME_TEMPLATE : " helm-v{{ .Version }}"
53+ name : helm-charts-${{ github.ref_name }}
54+ path : charts/.ci-build/*
55+ retention-days : 30
56+
57+ - name : Publish to GH-Pages
58+ id : ghpublish
59+ run : |
60+ git checkout $GH_PAGES_BRANCH --force
61+ helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
62+ cp charts/.ci-build/index.yaml index.yaml
63+ echo "New index:" && cat index.yaml
64+ git add index.yaml charts
65+ git commit -a -m "bot: update pages index for helm charts"
66+ git push origin $GH_PAGES_BRANCH
0 commit comments