From dd0ecfd090ba3e7a464badcd30b7bf78945c72e9 Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Wed, 16 Oct 2024 16:28:08 +0200 Subject: [PATCH] Release pipeline for helm chart Signed-off-by: Jirka Kremser --- .github/workflows/release-chart.yaml | 32 +++++++++++++++++++++++++--- Makefile | 2 +- helmchart/otel-add-on/Chart.yaml | 4 ++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-chart.yaml b/.github/workflows/release-chart.yaml index 27b28cf..3a9376a 100644 --- a/.github/workflows/release-chart.yaml +++ b/.github/workflows/release-chart.yaml @@ -1,15 +1,41 @@ name: Helm Publish on: - release: - types: - - published + push: + branches: + - 'main' + paths: + - 'helmchart/otel-add-on/Chart.yaml' permissions: contents: read jobs: + check-if-new-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PAT_TOKEN }} + - name: yq + uses: mikefarah/yq@3.3.0 + - name: Compare versions + run: | + latest_version=$(make version) + maybe_old_version=$(yq '.version' helmchart/otel-add-on/Chart.yaml) + echo "latest_version: ${latest_version}" + echo "maybe_old_version: ${maybe_old_version}" + if [ "${latest_version}" != "${maybe_old_version}" ]; then + echo "modifying Chart.yaml.." + yq -i ".version=${latest_version} | .appVersion=${latest_version}" helmchart/otel-add-on/Chart.yaml + git add helmchart/otel-add-on/Chart.yaml + git commit -s -m "Updating Chart.yaml: ${maybe_old_version} -> ${latest_version}" + git push + fi + test: runs-on: ubuntu-latest + needs: [check-if-new-version] steps: - uses: actions/checkout@v4 with: diff --git a/Makefile b/Makefile index bcb0e4b..cdf034c 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ help: ## Show this help. .PHONY: version version: - @echo $(VERSION) + @echo $(LATEST_TAG) ifndef NO_COLOR YELLOW=\033[0;33m diff --git a/helmchart/otel-add-on/Chart.yaml b/helmchart/otel-add-on/Chart.yaml index e8e98f6..9269073 100644 --- a/helmchart/otel-add-on/Chart.yaml +++ b/helmchart/otel-add-on/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: otel-add-on description: A Helm chart for otel-add-on type: application -version: 0.0.1 -appVersion: "0.0.1" +version: v0.0.0-1 +appVersion: v0.0.0-1 kubeVersion: ">= 1.19.0-0" icon: https://raw.githubusercontent.com/kedacore/keda/main/images/keda-logo-500x500-white.png