diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30ef30e..fbf2ebb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,7 @@ concurrency: ${{ github.workflow }}-${{ github.ref }} permissions: contents: write + packages: write pull-requests: write jobs: release: @@ -59,3 +60,24 @@ jobs: config: .github/cr.yaml env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Push charts to GHCR + if: steps.changesets.outputs.hasChangesets == 'false' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OCI_REPO: oci://ghcr.io/clickhouse/charts + run: | + echo "$GH_TOKEN" | helm registry login ghcr.io -u "$GITHUB_ACTOR" --password-stdin + pkgs=$(mktemp -d) + # Push the GitHub release asset, not a fresh package, so GHCR serves the same bytes as the Pages repo. + for chart in charts/*/Chart.yaml; do + read -r name version < <(yq '.name + " " + .version' "$chart") + tag="$name-$version" + if ! gh release view "$tag" >/dev/null 2>&1; then + echo "$tag has no GitHub release, skipping" + elif helm show chart "$OCI_REPO/$name" --version "$version" >/dev/null 2>&1; then + echo "$tag already in $OCI_REPO, skipping" + else + gh release download "$tag" -p "$tag.tgz" -D "$pkgs" + helm push "$pkgs/$tag.tgz" "$OCI_REPO" + fi + done