From 3fd82ba374fa09ba5bf38ca7a6952f230daab65a Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Fri, 22 Nov 2024 11:06:30 +0100 Subject: [PATCH] feat: push helm charts in OCI format to ghcr.io (#134) Signed-off-by: Ludovic Ortega --- .github/workflows/releases.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index ed6f4ec..b4c3533 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -7,6 +7,8 @@ jobs: release: permissions: contents: write + packages: write + id-token: write runs-on: ubuntu-latest steps: - name: Checkout @@ -17,9 +19,31 @@ jobs: run: | git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + # Release tgz to github page - name: Run chart-releaser uses: helm/chart-releaser-action@v1.6.0 with: config: "./cr.yaml" env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + # Release to OCI registry + - 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