Skip to content

Commit 3590d97

Browse files
committed
ci: automate helm chart release alongside package release
1 parent 41434b5 commit 3590d97

3 files changed

Lines changed: 60 additions & 4 deletions

File tree

.github/workflows/changesets-pr.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,35 @@ jobs:
121121
else
122122
echo "No changes to commit"
123123
fi
124+
125+
bump-chart-version:
126+
name: Bump Helm chart version on release PR
127+
runs-on: ubuntu-latest
128+
needs: update-lockfile
129+
permissions:
130+
contents: write
131+
steps:
132+
- name: Checkout release branch
133+
uses: actions/checkout@v4
134+
with:
135+
ref: changeset-release/main
136+
137+
- name: Bump Chart.yaml
138+
run: |
139+
set -e
140+
VERSION=$(jq -r '.version' packages/cli-v3/package.json)
141+
sed -i "s/^version:.*/version: ${VERSION}/" ./hosting/k8s/helm/Chart.yaml
142+
sed -i "s/^appVersion:.*/appVersion: v${VERSION}/" ./hosting/k8s/helm/Chart.yaml
143+
144+
- name: Commit and push Chart.yaml bump
145+
run: |
146+
set -e
147+
git config user.name "github-actions[bot]"
148+
git config user.email "github-actions[bot]@users.noreply.github.com"
149+
git add hosting/k8s/helm/Chart.yaml
150+
if ! git diff --cached --quiet; then
151+
git commit -m "chore: bump helm chart version for release"
152+
git push origin changeset-release/main
153+
else
154+
echo "Chart.yaml already at target version, no-op"
155+
fi

.github/workflows/release-helm.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- 'helm-v*'
7+
workflow_call:
8+
inputs:
9+
chart_version:
10+
description: 'Chart version to release'
11+
required: true
12+
type: string
713
workflow_dispatch:
814
inputs:
915
chart_version:
@@ -86,8 +92,8 @@ jobs:
8692
- name: Extract version from tag or input
8793
id: version
8894
run: |
89-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
90-
VERSION="${{ github.event.inputs.chart_version }}"
95+
if [ -n "${{ inputs.chart_version }}" ]; then
96+
VERSION="${{ inputs.chart_version }}"
9197
else
9298
VERSION="${{ github.ref_name }}"
9399
VERSION="${VERSION#helm-v}"
@@ -122,9 +128,8 @@ jobs:
122128
- name: Create GitHub Release
123129
id: release
124130
uses: softprops/action-gh-release@v1
125-
if: github.event_name == 'push'
126131
with:
127-
tag_name: ${{ github.ref_name }}
132+
tag_name: helm-v${{ steps.version.outputs.version }}
128133
name: "Helm Chart ${{ steps.version.outputs.version }}"
129134
body: |
130135
### Installation

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ jobs:
142142
git tag "v.docker.${{ steps.get_version.outputs.package_version }}"
143143
git push origin "v.docker.${{ steps.get_version.outputs.package_version }}"
144144
145+
- name: Create and push Helm chart tag
146+
if: steps.changesets.outputs.published == 'true'
147+
run: |
148+
set -e
149+
git tag "helm-v${{ steps.get_version.outputs.package_version }}"
150+
git push origin "helm-v${{ steps.get_version.outputs.package_version }}"
151+
145152
# Trigger Docker builds directly via workflow_call since tags pushed with
146153
# GITHUB_TOKEN don't trigger other workflows (GitHub Actions limitation).
147154
publish-docker:
@@ -153,6 +160,18 @@ jobs:
153160
with:
154161
image_tag: v${{ needs.release.outputs.published_package_version }}
155162

163+
# Trigger Helm chart release directly via workflow_call (same GITHUB_TOKEN
164+
# limitation as the Docker path). Runs after Docker images are published so
165+
# the chart never references images that don't exist yet.
166+
publish-helm:
167+
name: 🧭 Publish Helm chart
168+
needs: [release, publish-docker]
169+
if: needs.release.outputs.published == 'true'
170+
uses: ./.github/workflows/release-helm.yml
171+
secrets: inherit
172+
with:
173+
chart_version: ${{ needs.release.outputs.published_package_version }}
174+
156175
# After Docker images are published, update the GitHub release with the exact GHCR tag URL.
157176
# The GHCR package version ID is only known after the image is pushed, so we query for it here.
158177
update-release:

0 commit comments

Comments
 (0)