Skip to content

ci: publish Helm chart repository via chart-releaser on release tags#200

Draft
aslakknutsen wants to merge 1 commit intonetworking-incubator:mainfrom
aslakknutsen:feat/issue-30-chart-releaser
Draft

ci: publish Helm chart repository via chart-releaser on release tags#200
aslakknutsen wants to merge 1 commit intonetworking-incubator:mainfrom
aslakknutsen:feat/issue-30-chart-releaser

Conversation

@aslakknutsen
Copy link
Copy Markdown
Contributor

@aslakknutsen aslakknutsen commented Mar 23, 2026

Summary

Add a publish-helm-chart-repo job to the release workflow that uses helm/chart-releaser-action (with skip_packaging) to publish the Helm chart to a GitHub Pages-hosted repository on each version tag.

  • New job packages the chart via make release.manifests, places the tarball in .cr-release-packages/, and delegates upload + index update to chart-releaser.
  • Removes dist/*.tgz from the softprops/action-gh-release step so chart-releaser is the sole publisher of the chart asset (avoids duplicate uploads).
  • Adds .cr.yaml pointing at gh-pages and documents helm repo add usage in the chart README.

Resolves: #175

Manual steps after merge

One-time (repository setup)

  1. Create gh-pages branch — the first successful publish-helm-chart-repo run will push index.yaml there via cr index --push. The branch does not need to exist beforehand (chart-releaser creates it), but if the push fails due to branch protection, create an empty gh-pages branch manually.
  2. Enable GitHub Pages — Settings → Pages → Source: branch gh-pages, folder / (root). This can only be done after gh-pages exists.
  3. Org policy — confirm the org allows Pages for this repo (some orgs restrict it).

Verification on first release tag

  1. Push a version tag (vX.Y.Z) and confirm the publish-helm-chart-repo job succeeds in Actions.
  2. Verify two release surfaces:
    • Tag release (draft): contains crds.yaml, operator.yaml, samples.yaml (no .tgz).
    • Chart Releaser release (<chart-name>-<version>): contains the chart .tgz; index.yaml on gh-pages references it.
  3. Smoke test:
    helm repo add coraza-kubernetes-operator \
      https://networking-incubator.github.io/coraza-kubernetes-operator/
    helm repo update
    helm search repo coraza-kubernetes-operator

Test plan

  • Push a test tag on a fork and confirm the workflow runs end-to-end
  • Verify gh-pages branch is created/updated with index.yaml
  • Verify helm repo add + helm search repo returns the chart
  • Verify the tag release no longer contains the .tgz (only manifests)
  • Verify pre-release tags set mark_as_latest: false

Copilot AI review requested due to automatic review settings March 23, 2026 09:30
@github-actions github-actions bot added this to the v0.4.0 milestone Mar 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Automates publishing the Helm chart as a GitHub Pages-hosted Helm repository on version tags, using helm/chart-releaser-action as part of the existing release workflow.

Changes:

  • Add a publish-helm-chart-repo job to package the chart and run chart-releaser (upload + index update to gh-pages).
  • Stop attaching dist/*.tgz to the version-tag GitHub release so chart-releaser is the sole publisher of the chart asset.
  • Add .cr.yaml configuration and document helm repo add installation via GitHub Pages in the chart README.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
charts/coraza-kubernetes-operator/README.md Documents installing the chart from a GitHub Pages Helm repo.
.github/workflows/release.yml Adds chart-repo publishing job and removes .tgz from the tag release assets.
.cr.yaml Configures chart-releaser to push the Helm index to the gh-pages branch.

run: |
rm -rf .cr-release-packages
mkdir -p .cr-release-packages
make release.manifests
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make release.manifests runs helm.sync (which can modify tracked chart files). If the repo ends up with a dirty working tree, chart-releaser’s cr index --push step can fail when switching branches (or accidentally include unrelated changes). It would be safer to assert the tree is clean after packaging (and fail early if not), or otherwise ensure the packaging step doesn’t leave local modifications before invoking chart-releaser.

Suggested change
make release.manifests
make release.manifests
# Ensure no tracked files were modified by packaging (e.g., via helm.sync)
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
echo "::error::Working tree is dirty after 'make release.manifests'. Aborting chart release."
echo "Modified tracked files:"
git status --porcelain --untracked-files=no
echo "Diff:"
git diff
exit 1
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@shaneutt shaneutt removed the size/M label Mar 24, 2026
Add publish-helm-chart-repo job using helm/chart-releaser-action with
skip_packaging and Makefile-built tarballs in .cr-release-packages.

Stop attaching dist/*.tgz from softprops; chart-releaser uploads the chart.

Add .cr.yaml (gh-pages) and document helm repo add for GitHub Pages.

Resolves networking-incubator#175

Signed-off-by: Aslak Knutsen <aslak@4fs.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Add Chart Releaser

3 participants