@@ -12,11 +12,10 @@ jobs:
1212 permissions :
1313 contents : write
1414 packages : write
15- id-token : write
1615
1716 steps :
18- - name : ' Checkout'
19- uses : ' actions/checkout@v5 '
17+ - name : Checkout
18+ uses : ' actions/checkout@v6 '
2019 with :
2120 fetch-depth : 0
2221
5049 --title="${tag#v}" \
5150 --generate-notes \
5251 install.yaml
52+
53+ helm-chart :
54+ runs-on : ubuntu-latest
55+ permissions :
56+ contents : read
57+ packages : write
58+
59+ steps :
60+ - name : Checkout
61+ uses : ' actions/checkout@v6'
62+ with :
63+ fetch-depth : 0
64+
65+ - name : Install Helm
66+ uses : azure/setup-helm@v4
67+ with :
68+ version : ' v3.14.0'
69+
70+ - name : Determine Chart Version
71+ id : version
72+ run : |
73+ if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
74+ # For tags: use semver (e.g., v1.2.3 → 1.2.3)
75+ VERSION="${{ github.ref_name }}"
76+ VERSION="${VERSION#v}" # Remove 'v' prefix
77+ else
78+ # For branches/PRs: use pre-release version (e.g., 0.0.0-main-abc1234)
79+ GIT_BRANCH="${{ github.ref_name }}"
80+ GIT_SHA="${{ github.sha }}"
81+ # Replace slashes with dashes for branch names (e.g., feature/foo → feature-foo)
82+ GIT_BRANCH="${GIT_BRANCH//\//-}"
83+ VERSION="0.0.0-${GIT_BRANCH}-${GIT_SHA:0:7}"
84+ fi
85+ echo "version=$VERSION" >> $GITHUB_OUTPUT
86+ echo "Chart Version: $VERSION"
87+
88+ - name : Update Chart Version
89+ run : |
90+ # Update Chart.yaml with dynamic version
91+ sed -i "s|^version:.*|version: ${{ steps.version.outputs.version }}|" chart/Chart.yaml
92+ sed -i "s|^appVersion:.*|appVersion: ${{ steps.version.outputs.version }}|" chart/Chart.yaml
93+
94+ - name : Update Image Tags for Release
95+ run : |
96+ # Update image tags in values.yaml to use the versioned images
97+ # This assumes Docker images were built with the same git tag
98+ sed -i "s|tag: latest|tag: ${{ steps.version.outputs.version }}|g" chart/values.yaml
99+
100+ - name : Package Helm Chart
101+ run : |
102+ helm package chart/ --destination .
103+
104+ - name : Log into Docker Registry
105+ uses : docker/login-action@v3
106+ with :
107+ registry : ghcr.io
108+ username : ${{ github.actor }}
109+ password : ${{ secrets.GITHUB_TOKEN }}
110+
111+ - name : Push Helm Chart to OCI Registry
112+ if : startsWith(github.ref, 'refs/tags/v')
113+ run : |
114+ helm push *.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
0 commit comments