From 57028497c1a622645e6bf59c0b61cfaf97c3a6f7 Mon Sep 17 00:00:00 2001 From: Ishan Sharma <38211728+ishuar@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:23:40 +0100 Subject: [PATCH] enable chart push to ghcr as oci artifact (#523) Signed-off-by: ishuar --- .github/workflows/release.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f186bb49..601e0f30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,16 +5,25 @@ on: branches: - main +permissions: + contents: write + packages: write ## needed for ghcr access + jobs: release: if: github.repository == 'vmware-tanzu/helm-charts' runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Install Helm + uses: azure/setup-helm@v3 + with: + version: 3.13.2 + - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" @@ -24,3 +33,20 @@ jobs: uses: helm/chart-releaser-action@v1.2.0 env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push Charts to GHCR + run: | + for pkg in .cr-release-packages/*; do + if [ -z "${pkg:-}" ]; then + break + fi + + helm push "${pkg}" oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts + done