-
Notifications
You must be signed in to change notification settings - Fork 14
61 lines (52 loc) · 1.83 KB
/
helm.yaml
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
name: Helm CI/CD
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
paths:
- "deploy/charts/**"
env:
CHART_NAME: burrito
CHART_PATH: ./deploy/charts/burrito
CHART_REPO: ghcr.io/${{ github.repository_owner }}/charts
jobs:
helm-render:
name: Helm Render
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Helm Render
run: helm template ${{ env.CHART_PATH }}
helm-push:
name: Helm Push
runs-on: ubuntu-latest
needs: helm-render
steps:
- name: Checkout
uses: actions/checkout@v4
- name: GHCR Login
run: echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Compute versions
shell: bash
run: |
CURRENT_VERSION=$(yq $CHART_PATH/Chart.yaml --expression .version)
if [[ ${{ github.event_name }} == 'pull_request' || ${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'branch' ]]; then
echo "VERSION=$(echo $CURRENT_VERSION-${{ github.sha }})" >> $GITHUB_ENV
echo "APP_VERSION=${{ github.sha }}" >> $GITHUB_ENV
elif [[ ${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'tag' ]]; then
echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/v//')" >> $GITHUB_ENV
echo "APP_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "Unsupported event type"
exit 1
fi
- name: Helm Package
run: helm package ${{ env.CHART_PATH }} -u --version ${{ env.VERSION }} --app-version ${{ env.APP_VERSION }}
- name: Helm Push
run: helm push ./${{ env.CHART_NAME }}-${{ env.VERSION }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts