Skip to content

Commit 5dbbc8d

Browse files
committed
Publish to ghcr.io/philips-software
1 parent 5f9700a commit 5dbbc8d

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'Helm Chart Repo (ghcr.io)'
2+
description: 'Turn your repo with charts into a Helm charts repo on GitHub Container Registry, ghcr.io (OCI-based). Works on private repos.'
3+
branding:
4+
icon: 'anchor'
5+
color: 'blue'
6+
inputs:
7+
chartsPath:
8+
description: 'The path where to find the charts. Usually either "charts/" or "./". Must end with a slash.'
9+
required: false
10+
default: './'
11+
token:
12+
description: 'GitHub Token {{ secrets.GITHUB_TOKEN }} with the privilege set to write packages.'
13+
required: true
14+
runs:
15+
using: "composite"
16+
steps:
17+
18+
- name: Package Helm Charts
19+
shell: bash
20+
run: |
21+
find ${CHARTS_PATH} -type f -name 'Chart.yaml' | sed -r 's|/[^/]+$||' | sort | uniq | xargs --verbose -L 1 helm dep up
22+
for d in ${CHARTS_PATH}*/ ; do
23+
if [[ ! -f "${d}Chart.yaml" ]]; then
24+
echo "${d}Chart.yaml not found. Skipping."
25+
continue
26+
fi
27+
echo "$d"
28+
helm package "$d" -u -d dist
29+
done
30+
env:
31+
CHARTS_PATH: ${{ inputs.chartsPath }}
32+
33+
- name: Login to GitHub Container Registry (helm)
34+
shell: bash
35+
run: echo "${GITHUB_TOKEN}" | helm registry login ${REGISTRY} --username ${GITHUB_ACTOR} --password-stdin
36+
env:
37+
REGISTRY: "ghcr.io/${{ github.repository }}"
38+
GITHUB_TOKEN: ${{ inputs.token }}
39+
40+
- name: Login to GitHub Container Registry (docker)
41+
shell: bash
42+
run: echo "${GITHUB_TOKEN}" | docker login ${REGISTRY} --username ${GITHUB_ACTOR} --password-stdin
43+
env:
44+
REGISTRY: "ghcr.io/${{ github.repository }}"
45+
GITHUB_TOKEN: ${{ inputs.token }}
46+
47+
- name: Push Helm Charts to Github Container Registry (OCI)
48+
shell: bash
49+
working-directory: dist
50+
run: |
51+
for f in *.tgz ; do
52+
echo "helm push $f oci://${REGISTRY}"
53+
helm push $f oci://${REGISTRY}
54+
done
55+
env:
56+
REGISTRY: "ghcr.io/${{ github.repository }}"

.github/workflows/helm.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Helm Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
helm:
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Install Helm
19+
uses: azure/setup-helm@v4
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Build and Push the Helm Charts to GitHub Container Registry
24+
uses: ./.github/actions/action-helm-chart-repo
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
chartsPath: ./helm-charts

0 commit comments

Comments
 (0)