File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+ # SPDX-FileCopyrightText: 2025 Andy Bavier <andybavier@gmail.com>
3+
4+ name : Publish Helm Chart to GitHub OCI Registry
5+
6+ on :
7+ workflow_call :
8+ inputs :
9+ chart_path :
10+ description : ' Path to the Helm chart directory to publish'
11+ required : true
12+ type : string
13+
14+ jobs :
15+ publish-ghcr :
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : read
19+ packages : write
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+
24+ - name : Install Helm
25+ uses : azure/setup-helm@v4
26+
27+ - name : Build chart dependencies
28+ run : |
29+ helm dep build ${{ inputs.chart_path }}
30+
31+ - name : Package Helm chart
32+ run : |
33+ helm package ${{ inputs.chart_path }}
34+
35+ - name : Login to GitHub Container Registry
36+ run : |
37+ echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
38+
39+ - name : Push chart to GHCR
40+ run : |
41+ # Convert owner name to lowercase for the registry URL
42+ OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
43+ CHART_NAME=$(basename ${{ inputs.chart_path }})
44+ helm push ${CHART_NAME}-*.tgz oci://ghcr.io/$OWNER
45+
46+ - name : Logout from GHCR
47+ if : always()
48+ run : |
49+ helm registry logout ghcr.io
You can’t perform that action at this time.
0 commit comments