Skip to content

Commit e77d9b3

Browse files
committed
fix: fix chart tag
Signed-off-by: Derek Su <[email protected]>
1 parent a6d29bb commit e77d9b3

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/helm-release.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Helm Release
2+
23
on:
34
push:
45
branches:
5-
- master
6-
- v*
6+
- master
77
tags:
8-
- v*
9-
pull_request:
8+
- v*
109

1110
permissions:
1211
packages: write
@@ -15,6 +14,7 @@ permissions:
1514
env:
1615
HELM_REGISTRY: ghcr.io
1716
CHART_DIR: deploy/chart/local-path-provisioner
17+
1818
jobs:
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

0 commit comments

Comments
 (0)