add ghcr oci image workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File: .github/workflows/publish-helm.yaml | |
name: Publish Helm Chart to GHCR | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.14.0 | |
- name: Install yq | |
uses: mikefarah/[email protected] | |
- name: Read chart version | |
id: chart | |
run: | | |
echo "version=$(yq -r '.version' Chart.yaml)" >> $GITHUB_OUTPUT | |
- name: Log in to GitHub Container Registry | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io \ | |
--username "${{ github.actor }}" --password-stdin | |
- name: Package & Push chart | |
run: | | |
# Package the chart from repo root (where Chart.yaml lives) | |
helm package . --destination . | |
# Push to GHCR under oc-community | |
TARBALL="oc-community-${{ steps.chart.outputs.version }}.tgz" | |
helm push "$TARBALL" oci://ghcr.io/${{ github.repository }}/oc-community |