-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
49 lines (46 loc) · 1.66 KB
/
action.yml
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
name: 'Helm Chart Repo (ghcr.io)'
description: 'Turn your repo with charts into a Helm charts repo on GitHub Container Registry, ghcr.io (OCI-based). Works on private repos.'
branding:
icon: 'anchor'
color: 'blue'
inputs:
chartsPath:
description: 'The path where to find the charts. Usually either "charts/" or "./". Must end with a slash.'
required: false
default: './'
token:
description: 'GitHub Token {{ secrets.GITHUB_TOKEN }} with the privilege set to write packages.'
required: true
runs:
using: "composite"
steps:
- name: Package Helm Charts
shell: bash
run: |
find ${CHARTS_PATH} -type f -name 'Chart.yaml' | sed -r 's|/[^/]+$||' | sort | uniq | xargs --verbose -L 1 helm dep up
for d in ${CHARTS_PATH}*/ ; do
if [[ ! -f "${d}Chart.yaml" ]]; then
echo "${d}Chart.yaml not found. Skipping."
continue
fi
echo "$d"
helm package "$d" -u -d dist
done
env:
CHARTS_PATH: ${{ inputs.chartsPath }}
- name: Login to GitHub Container Registry
shell: bash
run: echo "${GITHUB_TOKEN}" | helm registry login ${REGISTRY} --username ${GITHUB_ACTOR} --password-stdin
env:
REGISTRY: "ghcr.io/${{ github.repository }}"
GITHUB_TOKEN: ${{ inputs.token }}
- name: Push Helm Charts to Github Container Registry (OCI)
shell: bash
working-directory: dist
run: |
for f in *.tgz ; do
echo "$f"
helm push $f oci://${REGISTRY,,}
done
env:
REGISTRY: "ghcr.io/${{ github.repository }}"