This repository was archived by the owner on Aug 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.13 KB
/
helm-publish.yaml
File metadata and controls
76 lines (65 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Lint/Builds/Push Helm charts to Github Registry
on:
pull_request:
push:
branches:
- main
- feature/django-app
paths:
- 'toggle/**'
permissions:
packages: write
jobs:
build:
name: Publish Helm
runs-on: ubuntu-latest
strategy:
matrix:
include:
# - chart: react-serve
- chart: django-app
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v3
# Lint/Build
- name: Helm dependency
working-directory: ./toggle/${{ matrix.chart }}
run: |
yq --indent 0 '.dependencies | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' ./Chart.lock | sh --
helm dependency build ./
- name: 🐳 Helm lint
working-directory: ./toggle/${{ matrix.chart }}
run: helm lint ./ --values ./values-test.yaml
- name: 🐳 Helm template
working-directory: ./toggle/${{ matrix.chart }}
run: helm template ./ --values ./values-test.yaml
# Publish
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: ${{ github.event_name == 'push' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Package Helm Chart
working-directory: ./toggle/${{ matrix.chart }}
if: ${{ github.event_name == 'push' }}
run: |
helm package ./ -d .helm-charts
- name: Push Helm Chart
working-directory: ./toggle/${{ matrix.chart }}
if: ${{ github.event_name == 'push' }}
env:
OCI_REPO: oci://ghcr.io/${{ github.repository }}
run: |
OCI_REPO=$(echo $OCI_REPO | tr '[:upper:]' '[:lower:]')
PACKAGE_FILE=$(ls .helm-charts/*.tgz | head -n 1)
echo "## Helm Chart" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Helm push output:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
helm push "$PACKAGE_FILE" $OCI_REPO >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY