Publish a helm chart using github actions and github pages

helm release github actions github pages

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

      - main

    runs-on: ubuntu-latest
      - name: Checkout
        uses: actions/checkout@v3
          fetch-depth: 0

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

      - name: Set up Helm
        uses: azure/setup-helm@v1
          version: v3.5.2

      - name: Run chart-releaser
        uses: helm/chart-releaser-action@v1.4.0
          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

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
          charts_dir: another_dir
          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