Chart Releaser Action to Automate GitHub Page Charts

This guide describes how to use Chart Releaser Action to automate releasing charts through GitHub pages. Chart Releaser Action is a GitHub Action workflow to turn a GitHub project into a self-hosted Helm chart repo, using helm/chart-releaser CLI tool.

Repository Changes

Create a Git repository under your GitHub organization. You could give the name of the repository as helm-charts, though other names are also acceptable. The sources of all the charts can be placed under the main branch. The charts should be placed under /charts directory at the top-level of the directory tree.

There should be another branch named gh-pages to publish the charts. The changes to that branch will be automatically created by the Chart Releaser Action described here. However, you can create that gh-branch and add README.md file, which is going to be visible to the users visiting the page.

You can add instruction in the README.md for charts installation like this (replace <alias>, <orgname>, and <chart-name>):

  1. ## Usage
  2. [Helm](https://helm.sh) must be installed to use the charts. Please refer to
  3. Helm's [documentation](https://helm.sh/docs) to get started.
  4. Once Helm has been set up correctly, add the repo as follows:
  5. helm repo add <alias> https://<orgname>.github.io/helm-charts
  6. If you had already added this repo earlier, run `helm repo update` to retrieve
  7. the latest versions of the packages. You can then run `helm search repo
  8. <alias>` to see the charts.
  9. To install the <chart-name> chart:
  10. helm install my-<chart-name> <alias>/<chart-name>
  11. To uninstall the chart:
  12. helm delete my-<chart-name>

The charts will be published to a website with URL like this:

  1. https://<orgname>.github.io/helm-charts

GitHub Actions Workflow

Create GitHub Actions workflow file in the main branch at .github/workflows/release.yml

  1. name: Release Charts
  2. on:
  3. push:
  4. branches:
  5. - main
  6. jobs:
  7. release:
  8. permissions:
  9. contents: write
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Checkout
  13. uses: actions/checkout@v4
  14. with:
  15. fetch-depth: 0
  16. - name: Configure Git
  17. run: |
  18. git config user.name "$GITHUB_ACTOR"
  19. git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
  20. - name: Run chart-releaser
  21. uses: helm/chart-releaser-action@v1.6.0
  22. env:
  23. CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

The above configuration uses @helm/chart-releaser-action to turn your GitHub project into a self-hosted Helm chart repo. It does this - during every push to main - by checking each chart in your project, and whenever there’s a new chart version, creates a corresponding GitHub release named for the chart version, adds Helm chart artifacts to the release, and creates or updates an index.yaml file with metadata about those releases, which is then hosted on GitHub pages.

The Chart Releaser Action version number used in the above example is v1.6.0. You can change it to the latest available version.

Note: The Chart Releaser Action is almost always used in tandem with the Helm Testing Action and Kind Action.