From ac897873d3f85aab9651b44ad6b4efd68425396a Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Fri, 22 Nov 2024 17:44:03 +0100 Subject: [PATCH] feat(helm): publish OCI helm charts Signed-off-by: Ludovic Ortega --- .github/workflows/release-chart.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-chart.yaml b/.github/workflows/release-chart.yaml index a92cf8400f..908050e044 100644 --- a/.github/workflows/release-chart.yaml +++ b/.github/workflows/release-chart.yaml @@ -11,7 +11,8 @@ permissions: {} jobs: release: permissions: - contents: write # to push chart release and create a release (helm/chart-releaser-action) + contents: write # to push chart release and create a release (helm/chart-releaser-action) + packages: write # needed for ghcr access if: github.repository == 'kubernetes-sigs/external-dns' runs-on: ubuntu-latest @@ -63,3 +64,22 @@ jobs: CR_RELEASE_NAME_TEMPLATE: "external-dns-helm-chart-{{ .Version }}" CR_RELEASE_NOTES_FILE: RELEASE.md CR_MAKE_RELEASE_LATEST: false + + - 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: | + lowercase=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') + shopt -s nullglob + for pkg in .cr-release-packages/*; do + if [ -z "${pkg:-}" ]; then + break + fi + echo "Pushing package - ${pkg} to ghcr.io repository - ${lowercase}" + helm push "${pkg}" "oci://ghcr.io/${lowercase}/charts" + done \ No newline at end of file