2 min read | by Jordi Prats
Having a helm chart released (via an index.yaml) is a convenient way of using it. Combining github actions with github pages we can do it in a serverless fashion
Let's assume we have the test vault helm chart that we want to release using a helm releaser. The github action would look like this:
name: Release Chart
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.5.2
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
This is going to create the index.yaml file and post it using github pages. The URL is going to look like this:
Therefore, for pet2cattle/helm-testvault, we can add the helm repo hosted using github pages with the following command:
helm repo add testvault https://pet2cattle.github.io/helm-testvault/
This action assumes the helm chart is going to be under the charts directory (it's actually looking for the Chart.yaml) with the following structure: charts/chartname/Chart.yaml
If we have the chart somewhere else, we must include a charts_dir input in the workflow:
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.0
with:
charts_dir: another_dir
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
The only consideration is that it won't pick up charts that are stored directly under the charts_dir directory: The chartname directory must exists
Posted on 31/10/2022