From c26b9a97c929e177c3be0e115cc9ddccc6b721e9 Mon Sep 17 00:00:00 2001
From: Geoff Flarity <geoff@centml.ai>
Date: Wed, 12 Jun 2024 10:25:53 -0400
Subject: [PATCH] add a helm chart release workflow

---
 .github/workflows/release_helm_chart.yaml | 46 +++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 .github/workflows/release_helm_chart.yaml

diff --git a/.github/workflows/release_helm_chart.yaml b/.github/workflows/release_helm_chart.yaml
new file mode 100644
index 0000000..d62fb78
--- /dev/null
+++ b/.github/workflows/release_helm_chart.yaml
@@ -0,0 +1,46 @@
+name: Release Helm Chart 
+
+on:
+  # Triggers the workflow when Chart.yaml is updated on the main branch
+  push:
+    branches:
+      - main
+    paths:
+      - "charts/simple-sidecar/Chart.yaml"
+
+  # Allows you to manually trigger the workflow from GitHub's UI
+  workflow_dispatch:
+
+jobs:
+  release_helm_chart:
+    # Permissions required for the job. In this case, write access to the repository contents is needed.
+    permissions:
+      contents: write
+    # Specifies the type of runner that the job will run on. Here, it's the latest version of Ubuntu.
+    runs-on: ubuntu-latest
+    steps:
+      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
+      - name: Checkout
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      # Configures Git with the GitHub actor's name and email to make commits and tags
+      - name: Configure Git
+        run: |
+          git config user.name "$GITHUB_ACTOR"
+          git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
+
+      # Runs the chart-releaser action which turns 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
+      - name: Run chart-releaser
+        uses: helm/chart-releaser-action@v1.6.0
+        env:
+          # GitHub token used by the chart-releaser action
+          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
+          # Customizes the name of the chart release
+          CR_RELEASE_NAME_TEMPLATE: "simple-sidecar-helm-chart-{{ .Version }}"
\ No newline at end of file