From ad464ef6653d49aca5dd8fdc7c2bb038890de01f Mon Sep 17 00:00:00 2001 From: Blagoj Atanasovski Date: Thu, 16 Jan 2025 13:20:45 +0100 Subject: [PATCH] Modify the GitHub actions to be able to publish the chart --- .github/workflows/bump_chart.py | 28 +++++------------- .github/workflows/publish-chart-in-cast.yaml | 8 +++++ charts/temporal/Chart.yaml | 31 ++++++++++---------- 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/.github/workflows/bump_chart.py b/.github/workflows/bump_chart.py index a0d0840d..33376cb0 100644 --- a/.github/workflows/bump_chart.py +++ b/.github/workflows/bump_chart.py @@ -4,10 +4,10 @@ if len(sys.argv) < 2 or sys.argv[1] == '': raise 'Chart.yaml path should be passed as first argument' -new_app_version='' +new_chart_version='' if len(sys.argv) >= 3 and sys.argv[2] != '': - print(f'New appVersion: {sys.argv[2]}') - new_app_version=sys.argv[2] + print(f'New chart version to set: {sys.argv[2]}') + new_chart_version=sys.argv[2] chart_yaml_path=sys.argv[1] @@ -18,27 +18,15 @@ # Auto bump version patch. match = re.search(r'version:\s*(.+)', chart_yaml) + if match: current_version = match.group(1) print(f'Current version: {current_version}') - parts = current_version.split('.') - current_major = parts[0] - current_minor = parts[1] - new_patch = int(parts[2])+1 - new_version = f'{current_major}.{current_minor}.{new_patch}' - updated_yaml = updated_yaml.replace(current_version, new_version) - print(f'Updated version: {new_version}') - -# Update appVersion. -if new_app_version != '': - match = re.search(r'appVersion:\s*(.+)', chart_yaml) - if match: - current_app_version = match.group(1) - print(f'Current appVersion: {current_app_version}') - - updated_yaml = updated_yaml.replace(current_app_version, f'"{new_app_version}"') - print(f'Updated appVersion: "{new_app_version}"') + updated_yaml = updated_yaml.replace(current_version, new_chart_version) + print(f'Updated version: {new_chart_version}') +else: + raise 'version field not found in Chart.yaml' with open(chart_yaml_path, 'w') as chart_file: chart_file.write(updated_yaml) \ No newline at end of file diff --git a/.github/workflows/publish-chart-in-cast.yaml b/.github/workflows/publish-chart-in-cast.yaml index 00a0b206..03539881 100644 --- a/.github/workflows/publish-chart-in-cast.yaml +++ b/.github/workflows/publish-chart-in-cast.yaml @@ -26,6 +26,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Get release tag + if: github.event_name == 'release' + run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Checkout helm-charts if: ${{ github.event_name == 'release' }} # The cr tool only works if the target repository is already checked out @@ -78,6 +82,10 @@ jobs: - name: Create helm package if: ${{ github.event_name == 'release' }} run: | + helm repo add prometheus-community https://prometheus-community.github.io/helm-charts + helm repo add incubator https://charts.helm.sh/incubator + helm repo add elasticsearch https://helm.elastic.co + helm repo add grafana https://grafana.github.io/helm-charts "${CR_TOOL_PATH}/cr" package "${{ steps.parse-chart.outputs.chartpath }}" --config "${CR_CONFIGFILE}" --package-path "${CR_PACKAGE_PATH}" echo "Result of chart package:" ls -l "${CR_PACKAGE_PATH}" diff --git a/charts/temporal/Chart.yaml b/charts/temporal/Chart.yaml index f8c68b85..45c6a18f 100644 --- a/charts/temporal/Chart.yaml +++ b/charts/temporal/Chart.yaml @@ -2,6 +2,21 @@ apiVersion: v2 name: temporal description: Temporal is a distributed, scalable, durable, and highly available orchestration engine to execute asynchronous long-running business logic in a scalable and resilient way. home: https://temporal.io/ +# 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 +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# 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. +version: 1.2.3 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: 1.26.2 keywords: - temporal - workflow @@ -28,18 +43,4 @@ dependencies: repository: https://grafana.github.io/helm-charts version: 8.0.2 condition: grafana.enabled -# 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 -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# 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. -version: 0.54.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. -appVersion: 1.26.2 +