update workflow to push chart to ghcr as oci image #2
Workflow file for this run
This file contains 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
name: Publish Helm Chart as OCI Image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- improved-helm-chart-deployment | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
publish-helm-chart: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Helm | |
uses: azure/setup-helm@v4 | |
- name: Cache Helm dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/helm | |
key: ${{ runner.os }}-helm-${{ hashFiles('keycloak-chart/Chart.lock') }} | |
restore-keys: | | |
${{ runner.os }}-helm- | |
- name: Helm lint | |
run: helm lint ./keycloak-chart | |
- name: Package Helm Charts | |
run: | | |
helm package ./keycloak-chart && mv keycloak-chart*.tgz ocr-keycloak.tgz | |
- name: Login to GitHub Container Registry | |
uses: docker/#-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Helm Charts to GitHub Container Registry (GHCR) | |
run: | | |
CHART_REPO="ghcr.io/${{ github.repository }}" | |
helm push ./ocr-keycloak.tgz oci://$CHART_REPO/keycloak | |
- name: Clean up temporary files | |
run: | | |
rm -f ocr-*.tgz |