How to create public helm chart repository with GitHub Pages

Host helm chart repository on GitHub pages using GitHub Actions

How to create public helm chart repository with GitHub Pages

In this article, we host earlier created Helm Chart as helm repository on GitHub Pages. You can visit earlier article on how to create helm chart and add sub-chart dependency.

Let's follow the below steps:

Create 'gh_pages` branch to publish

To publish the helm repository to GitHub pages, create a gh_pages branch in your repo.

# Create new empty branch without parent
git checkout --orphan gh-pages
# remove local files 
git rm -rf . 
# Make empty commit to push
git commit --allow-empty  -m "Initial Commit"
# push branch to origin
git push

Configure GitHub Repo to publish github_pages

To publish the github_pages branch , you need to setup Settings > Pages in your repository and it should show you the URL of hosted pages.

Screen Shot 2021-11-30 at 10.07.18 PM.png

Create a personal token

We need to create personal token to pass to Helm Chart Release workflow. Visit Settings > Developer Settings > Personal Access Token. Generate Personal token with Scopes repo, workflow, write:packages

Keep the token safely and never share with anyone

Screen Shot 2021-11-30 at 10.12.56 PM.png

Create Repository Secret

To provide a token to workflow, you need to visit Settings > Secrets for your repository and add REPO_TOKEN with value of personal token created in previous step.

Screen Shot 2021-11-30 at 10.14.58 PM.png

Also verify that default GITHUB_TOKEN has read and write permission by visiting repository Settings > Actions

Screen Shot 2021-11-30 at 10.25.26 PM.png

Create GitHub Action workflow for PullRequest

helm-pr.yaml workflow will trigger on pull request (PR) and perform below steps:

  • Checkout the code on runner
  • Set up Helm on runner i.e. helm tools
  • Set up Helm Chart Testing tools ct
  • Add required helm chart dependencies
  • List changes for Chart testing - it checks changes compared to base branch in this case main
  • Chart Lint - it examines charts for possible issues and runs series of tests to verify that chart is well-formed
  • Create Kubernetes kind cluster to install the chart
  • Install chart to Kubernetes cluster created in previous step and run the tests in template/tests

If all the checks are successful then PR is good to merge and reviewer can merge the changes.


name: Helm PR Workflow



    runs-on: ubuntu-latest
    name: Helm Chart Lint
      CT_CHART_DIRS: charts
      - name: Checkout
        uses: actions/checkout@v2
          fetch-depth: 0

      - name: Set up Helm
        uses: azure/setup-helm@v1

      - uses: actions/setup-python@v2
          python-version: 3.7

      - name: Set up chart-testing
        uses: helm/chart-testing-action@v2.1.0

      - name: Add Helm Repo dependencies
        run: helm repo add bitnami

      - name: Run chart-testing (list-changed)
        id: list-changed
        run: |
          changed=$(ct list-changed --target-branch $GITHUB_BASE_REF)
          if [[ -n "$changed" ]]; then
            echo "::set-output name=changed::true"

      - name: Run chart-testing (lint)
        run: ct lint --target-branch $GITHUB_BASE_REF

      - name: Create kind Kubernetes cluster
        uses: helm/kind-action@v1.2.0
        if: steps.list-changed.outputs.changed == 'true'

      - name: Run chart-testing (install)
        run: ct install --target-branch $GITHUB_BASE_REF

You can check sample Helm PR workflow here

Screen Shot 2021-11-30 at 7.10.01 PM.png

Create Workflow for Helm Chart Release

helm-release.yaml workflow triggers on commit to main branch and performs below steps:


name: Helm Release Workflow

      - main

    runs-on: ubuntu-latest
    name: Release Helm Chart
      - name: Checkout
        uses: actions/checkout@v2
          fetch-depth: 0

      - name: Configure Git
        run: |
          git config --global "$GITHUB_ACTOR"
          git config --global "$"

      - name: Install Helm
        uses: azure/setup-helm@v1

      - name: Add Helm Repo dependencies
        run: helm repo add bitnami

      - name: Run User chart-releaser
        uses: helm/chart-releaser-action@v1.2.1
          CR_TOKEN: "${{ secrets.REPO_TOKEN }}"
          CR_SKIP_EXISTING: true
          charts_dir: charts

You can check sample helm release workflow run here

Screen Shot 2021-11-30 at 7.07.51 PM.png

Access Helm Repository

On successful workflow run, you would get helm repo available on

You can try adding repository to your environment and installing myapp chart

# add helm repository
helm repo add sachin

# search chart
helm search repo sachin

# install chart
helm install demo-app sachin/myapp

I hope you got an overview of Helm Repository using GitHub action to setup CI-CD pipeline.

Thanks for reading! I would appreciate your feedback on the articles, it will motivate me to keep writing.