Skip to content

Commit a8075f3

Browse files
committed
feat: CD workflow for publishing helm charts
1 parent 5406908 commit a8075f3

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/helm.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 📊 Publish Helm Chart to GHCR
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Optional version tag (e.g. 0.0.9)'
11+
required: false
12+
13+
permissions:
14+
contents: write
15+
packages: write
16+
17+
jobs:
18+
publish:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: 🛎️ Check out repo
22+
uses: actions/checkout@v4
23+
24+
- name: 🔧 Set up Helm
25+
uses: azure/setup-helm@v4
26+
with:
27+
version: v3.14.4
28+
29+
- name: 🧰 Login to GHCR
30+
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
31+
32+
- name: 🏷️ Determine version tag
33+
id: vars
34+
run: |
35+
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
36+
VERSION="${GITHUB_REF#refs/tags/v}"
37+
elif [[ -n "${{ github.event.inputs.tag }}" ]]; then
38+
VERSION="${{ github.event.inputs.tag }}"
39+
else
40+
echo "❌ No valid version provided."
41+
exit 1
42+
fi
43+
echo "tag=$VERSION" >> $GITHUB_OUTPUT
44+
45+
- name: 📝 Patch Chart.yaml with version
46+
run: |
47+
sed -i "s/^version: .*/version: ${{ steps.vars.outputs.tag }}/" helm/Chart.yaml
48+
sed -i "s/^appVersion: .*/appVersion: \"${{ steps.vars.outputs.tag }}\"/" helm/Chart.yaml
49+
50+
- name: 📦 Package Helm chart
51+
run: helm package helm
52+
53+
- name: 🚀 Push Helm chart to GHCR
54+
run: |
55+
helm push domain-locker-${{ steps.vars.outputs.tag }}.tgz oci://ghcr.io/lissy93

0 commit comments

Comments
 (0)