Skip to content

Commit

Permalink
Modify the GitHub actions to be able to publish the chart
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasovskib committed Jan 16, 2025
1 parent 0a65c77 commit ad464ef
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
28 changes: 8 additions & 20 deletions .github/workflows/bump_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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)
8 changes: 8 additions & 0 deletions .github/workflows/publish-chart-in-cast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
31 changes: 16 additions & 15 deletions charts/temporal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit ad464ef

Please sign in to comment.