From 23b867c463d5967cc38fa5e2f9290f14e4090ecf Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 6 Jun 2026 06:24:40 +0330 Subject: [PATCH] Publish Helm charts to GitHub Releases and GHCR OCI. Add workflow_dispatch and OCI push since GitHub Pages is unavailable on this plan. Co-authored-by: Cursor --- .github/workflows/release-chart.yaml | 25 +++++++++++++++++++++++++ README.md | 21 ++++++++++++++++----- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-chart.yaml b/.github/workflows/release-chart.yaml index b7f189e..93cd6fc 100644 --- a/.github/workflows/release-chart.yaml +++ b/.github/workflows/release-chart.yaml @@ -8,9 +8,11 @@ on: - charts/** - .cr.yaml - .github/workflows/release-chart.yaml + workflow_dispatch: permissions: contents: write + packages: write jobs: release: @@ -26,6 +28,9 @@ jobs: git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Install Helm + uses: azure/setup-helm@v4 + - name: Run chart-releaser uses: helm/chart-releaser-action@v1.7.0 with: @@ -33,3 +38,23 @@ jobs: config: .cr.yaml env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push chart to OCI registry + run: | + shopt -s nullglob + charts=(.cr-release-packages/*.tgz) + if [ ${#charts[@]} -eq 0 ]; then + echo "No packaged charts to push" + exit 0 + fi + owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]') + for chart in "${charts[@]}"; do + helm push "$chart" "oci://ghcr.io/${owner}/charts" + done diff --git a/README.md b/README.md index 27fb864..95ef994 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,24 @@ Driver name: `storage.csi.kloud.team` ### From the published chart repository -Charts are published to GitHub Pages on each release: +Charts are published as [GitHub Releases](https://github.com/KubelanCloud/kks-csi-plugin/releases) and to GHCR as OCI artifacts. + +**OCI (recommended):** ```bash -helm repo add kloud-csi https://kubelancloud.github.io/kks-csi-plugin -helm repo update +helm install kloud-csi oci://ghcr.io/kubelancloud/charts/kloud-csi \ + --version 0.1.0 \ + --namespace kube-system \ + --create-namespace \ + --set serverURL=https://csi.example.kloud.team \ + --set accessToken="YOUR_CLUSTER_CSI_ACCESS_TOKEN" +``` -helm install kloud-csi kloud-csi/kloud-csi \ +**GitHub Release asset:** + +```bash +helm install kloud-csi \ + https://github.com/KubelanCloud/kks-csi-plugin/releases/download/kloud-csi-0.1.0/kloud-csi-0.1.0.tgz \ --namespace kube-system \ --create-namespace \ --set serverURL=https://csi.example.kloud.team \ @@ -108,7 +119,7 @@ kubectl get storageclass kloud-csi Chart path: [`charts/kloud-csi`](charts/kloud-csi) -Published releases are available at [GitHub Releases](https://github.com/KubelanCloud/kks-csi-plugin/releases) and via the Helm repository at `https://kubelancloud.github.io/kks-csi-plugin`. Bump `version` in [`Chart.yaml`](charts/kloud-csi/Chart.yaml) to publish a new chart release. +Published releases are available at [GitHub Releases](https://github.com/KubelanCloud/kks-csi-plugin/releases) and as OCI charts at `oci://ghcr.io/kubelancloud/charts/kloud-csi`. Bump `version` in [`Chart.yaml`](charts/kloud-csi/Chart.yaml) to publish a new chart release. ### Required values