How to create a public Helm chart repository with GitHub pages

Introduction

When you create a Helm chart, you need a repository to store the chart. so you can store Helm chart in GitHub pages.

Guide

Create a repository called helm-charts and set Public on GitHub

new repo

Clone source code

1
git clone [email protected]:blackhorseya/helm-charts.git && cd helm-charts

Write down README.md

1
echo "# Kubernetes Helm Charts" > README.md

Create a branch called gh-pages, this is important

1
git branch -b gh-pages

Update GitHub pages setting, set Source to gh-pages branch.

github pages setting

Create GitHub action workflows mkdir -p .github/workflows and touch .github/workflows/release.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: Release Charts

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Now, you can create your helm chart in charts folder.

Usage

Create a new Helm chart

Create sample Helm chart on main branch.

1
2
3
4
helm create charts/sample
git add .
git commit -m 'feat: added sample helm chart'
git push

Add your repo

1
helm repo add blackhorseya https://blackhorseya.github.io/helm-charts

You can then run helm search repo blackhorseya to see the charts.

Reference

chart releaser action