File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change 11name : Helm Release
2+
23on :
34 push :
45 branches :
5- - master
6- - v*
6+ - master
77 tags :
8- - v*
9- pull_request :
8+ - v*
109
1110permissions :
1211 packages : write
@@ -15,6 +14,7 @@ permissions:
1514env :
1615 HELM_REGISTRY : ghcr.io
1716 CHART_DIR : deploy/chart/local-path-provisioner
17+
1818jobs :
1919 build_push_helm_chart :
2020 name : Build and Push Chart
@@ -23,14 +23,30 @@ jobs:
2323 - name : Checkout repository
2424 uses : actions/checkout@v4
2525
26+ - name : Set Chart Tag
27+ id : set_tag
28+ run : |
29+ if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
30+ echo "chart_tag=master-head" >> "$GITHUB_OUTPUT"
31+ elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
32+ version="${GITHUB_REF#refs/tags/v}"
33+ echo "chart_tag=${version}" >> "$GITHUB_OUTPUT"
34+ else
35+ echo "Unknown ref: ${GITHUB_REF}"
36+ exit 1
37+ fi
38+
2639 - name : Log in to the Container registry
2740 uses : docker/login-action@v3
2841 with :
2942 registry : ${{ env.HELM_REGISTRY }}
3043 username : ${{ github.actor }}
3144 password : ${{ secrets.GITHUB_TOKEN }}
3245
33- - name : Publish OCI helm chart
46+ - name : Package Helm chart
47+ run : |
48+ helm package ./${{ env.CHART_DIR }} --destination ./chart --version ${{ steps.set_tag.outputs.chart_tag }}
49+
50+ - name : Push Helm chart
3451 run : |
35- helm package ./${{ env.CHART_DIR }} --destination ./chart
3652 helm push ./chart/*.tgz oci://${{ env.HELM_REGISTRY }}/${{ github.repository_owner }}/${{ github.event.repository.name }}/charts
You can’t perform that action at this time.
0 commit comments