-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (43 loc) · 1.54 KB
/
release-oci.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
name: Release to GHCR
on:
push:
branches:
- main
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release-helm-chart:
name: Release Helm Chart
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 2
- name: Login to container registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Pushing Helm Chart
run: |
prev_rev=$(git rev-parse HEAD^)
echo "Identifying changed charts since git rev ${prev_rev}"
changed_charts=()
readarray -t changed_charts <<< "$(git diff --find-renames --diff-filter=d --name-only "$prev_rev" -- charts | cut -d '/' -f 2 | uniq)"
if [[ -n "${changed_charts[*]}" ]]; then
for chart in "${changed_charts[@]}"; do
#echo "Updating dependencies for '$chart'..."
helm dependency update "charts/$chart"
# create chart package for chart `CHART`
helm package charts/$chart
# get packed chart file name
PKG_NAME=`ls $chart-*.tgz`
# push chart to registry
helm push ${PKG_NAME} oci://ghcr.io/${GITHUB_REPOSITORY}
# remove chart package
rm ${PKG_NAME}
done
else
echo "No chart changes detected"
fi