Browse Source

feat: Also publish helm chart to OCI registry (ghcr.io) (#3209)

Marco Maurer (-Kilchhofer) 2 years ago
parent
commit
579af16589
1 changed files with 24 additions and 1 deletions
  1. 24 1
      .github/workflows/helm.yml

+ 24 - 1
.github/workflows/helm.yml

@@ -32,7 +32,7 @@ jobs:
       - name: Set up Helm
         uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
         with:
-          version: v3.4.2
+          version: v3.14.2 # remember to also update for the second job (release)
 
       - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
         with:
@@ -70,6 +70,7 @@ jobs:
   release:
     permissions:
       contents: write  # for helm/chart-releaser-action to push chart release and create a release
+      packages: write  # to push OCI chart package to GitHub Registry
     runs-on: ubuntu-latest
     steps:
       - name: Checkout
@@ -111,3 +112,25 @@ jobs:
           charts_dir: deploy/charts
           skip_existing: true
           charts_repo_url: https://charts.external-secrets.io
+
+      - name: Set up Helm
+        uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
+        with:
+          version: v3.14.2 # remember to also update for the first job (lint-and-test)
+
+      - name: Login to GHCR
+        uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Push chart to GHCR
+        run: |
+          shopt -s nullglob
+          for pkg in .cr-release-packages/*.tgz; do
+            if [ -z "${pkg:-}" ]; then
+              break
+            fi
+            helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts"
+          done