From e86dc373967a9989c0f20637c112cca9870ad67c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=BC=C3=9F?= Date: Mon, 28 Oct 2024 13:14:32 +0100 Subject: [PATCH] feat: release helm charts to grafana/helm-charts --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++- Makefile | 8 +++++++ deploy/helm/grafana-operator/Chart.yaml | 16 ++++--------- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c72bc3f35..525a776f3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,9 +13,25 @@ jobs: helm: runs-on: ubuntu-latest steps: - - name: Clone repo + - name: Create a GitHub App installation access token + uses: tibdex/github-app-token@v2 + id: app-token + with: + app_id: ${{ secrets.GRAFANA_OPERATOR_HELM_RELEASE_APP_ID }} + private_key: ${{ secrets.GRAFANA_OPERATOR_HELM_RELEASE_PEM_KEY }} + + - name: Set the correct token (Github App or PAT) + run: | + echo "AUTHTOKEN=${{ steps.app-token.outputs.token }}" >> $GITHUB_ENV + + - name: Checkout uses: actions/checkout@v4 + - name: Install Helm + uses: azure/setup-helm@v4 + with: + version: v3.16.2 + - name: Prepare run: | # OCI standard enforces lower-case paths @@ -30,8 +46,22 @@ jobs: yq -i '.image.repository = "${{ env.GHCR_REPO }}"' grafana-operator/values.yaml helm registry login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io helm package --app-version ${{ github.ref_name }} --version ${{ github.ref_name }} grafana-operator + helm push grafana-operator-${{ github.ref_name }}.tgz ${{ env.HELM_REPO }} + - name: Make github release + uses: softprops/action-gh-release@v1 + with: + body: | + Helm chart for the [grafana-operator](https://github.com/${{ github.repository }} + + Tag on source: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }} + files: | + deploy/helm/grafana-operator-${{ github.ref_name }}.tgz + repository: grafana/helm-charts + tag_name: grafana-operator-${{ github.ref_name }} + token: ${{ env.AUTHTOKEN }} + kustomize: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index fe2288880..fe56fb61f 100644 --- a/Makefile +++ b/Makefile @@ -420,3 +420,11 @@ API_REF_GEN=$(GOBIN)/crdoc else API_REF_GEN=$(shell which crdoc) endif + +.PHONY: prep-release +prep-release: yq + $(YQ) -i '.version="v$(VERSION)"' deploy/helm/grafana-operator/Chart.yaml + $(YQ) -i '.appVersion="v$(VERSION)"' deploy/helm/grafana-operator/Chart.yaml + $(YQ) -i '.params.version="v$(VERSION)"' hugo/config.yaml + sed -i 's/--version v5.*/--version v$(VERSION)/g' README.md + make helm/docs diff --git a/deploy/helm/grafana-operator/Chart.yaml b/deploy/helm/grafana-operator/Chart.yaml index d5f5f2dd8..91aab620c 100644 --- a/deploy/helm/grafana-operator/Chart.yaml +++ b/deploy/helm/grafana-operator/Chart.yaml @@ -1,7 +1,6 @@ apiVersion: v2 name: grafana-operator -description: A Helm chart for Kubernetes - +description: Helm chart for the Grafana Operator # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives @@ -11,14 +10,7 @@ description: A Helm chart for Kubernetes # a dependency of application charts to inject those utilities and functions into the rendering # pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.3.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. +# We keep the version and appVersion in sync as most updates also include +# changes to the CRDs which are bundled with the helm resources +version: v5.14.0 appVersion: "v5.14.0"