From 3f9fcbbb4d6c6069718637fa7f50df2bc9a80645 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Fri, 22 Nov 2024 17:36:39 +0100 Subject: [PATCH 1/3] feat(helm): publish OCI helm charts Signed-off-by: Ludovic Ortega --- .github/workflows/release.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e15bdcac5..2066bbec9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 @@ -39,3 +43,22 @@ jobs: env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" CR_GENERATE_RELEASE_NOTES: true + + - 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 \ No newline at end of file From 516508a69f5b0ff87a141b4e7d40fa998330fd68 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Wed, 27 Nov 2024 09:14:22 +0100 Subject: [PATCH 2/3] fix: remove lowercase setup as discussed in review --- .github/workflows/release.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2066bbec9..f36a7b625 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,7 +58,5 @@ jobs: 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 \ No newline at end of file + helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts" + done From d919abae76810987e9dea0fb5f9e83f7798a3590 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Wed, 27 Nov 2024 09:19:44 +0100 Subject: [PATCH 3/3] fix: use repository variable --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f36a7b625..53008d5af 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,5 +58,5 @@ jobs: if [ -z "${pkg:-}" ]; then break fi - helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts" + helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY}" done