From 845ab407c0c2f6e17c82e8aafd6f9ddd802ece83 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Fri, 22 Nov 2024 17:35:54 +0100 Subject: [PATCH] feat(helm): publish OCI helm charts Signed-off-by: Ludovic Ortega --- .github/workflows/release.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a00ad4..77b0684 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,10 @@ on: jobs: release: + permissions: + contents: write # to push chart release and create a release (helm/chart-releaser-action) + packages: write # needed for ghcr access + runs-on: ubuntu-latest steps: - name: Checkout @@ -23,3 +27,22 @@ jobs: uses: helm/chart-releaser-action@v1.4.1 env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push charts to GHCR + run: | + shopt -s nullglob + for pkg in .cr-release-packages/*; do + if [ -z "${pkg:-}" ]; then + break + fi + lowercase=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]') + echo "Pushing package - ${pkg} to ghcr.io repository - ${lowercase}" + helm push "${pkg}" "oci://ghcr.io/${lowercase}" + done