Skip to content

Commit 4c468d4

Browse files
authored
Add helm to release process. (#111)
Second stage of #11.
1 parent f819246 commit 4c468d4

File tree

5 files changed

+169
-5
lines changed

5 files changed

+169
-5
lines changed

.github/workflows/helm.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Package and Publish Helm Chart
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_bump:
7+
description: 'Type of version bump to perform'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Configure Git
26+
run: |
27+
git config user.name "$GITHUB_ACTOR"
28+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
29+
30+
- name: Install Helm
31+
uses: azure/setup-helm@v3
32+
with:
33+
version: v3.12.0
34+
35+
- name: Bump Chart Version
36+
id: bump_version
37+
run: |
38+
# Get current version from Chart.yaml
39+
CURRENT_VERSION=$(grep 'version:' helm/temporal-worker-controller/Chart.yaml | awk '{print $2}')
40+
echo "Current version: $CURRENT_VERSION"
41+
42+
# Split version into parts
43+
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
44+
MAJOR=${VERSION_PARTS[0]}
45+
MINOR=${VERSION_PARTS[1]}
46+
PATCH=${VERSION_PARTS[2]}
47+
48+
# Increment version based on input
49+
if [[ "${{ inputs.version_bump }}" == "major" ]]; then
50+
MAJOR=$((MAJOR + 1))
51+
MINOR=0
52+
PATCH=0
53+
elif [[ "${{ inputs.version_bump }}" == "minor" ]]; then
54+
MINOR=$((MINOR + 1))
55+
PATCH=0
56+
else
57+
PATCH=$((PATCH + 1))
58+
fi
59+
60+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
61+
echo "New version: $NEW_VERSION"
62+
63+
# Update Chart.yaml with new version
64+
sed -i "s/version: $CURRENT_VERSION/version: $NEW_VERSION/g" helm/temporal-worker-controller/Chart.yaml
65+
66+
# Set output variable for use in later steps
67+
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
68+
69+
# Commit the change
70+
git add helm/temporal-worker-controller/Chart.yaml
71+
git commit -m "Bump chart version to $NEW_VERSION [skip ci]"
72+
git push
73+
74+
- name: Login to Docker Hub
75+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
76+
with:
77+
registry: docker.io
78+
username: ${{ secrets.DOCKER_USERNAME }}
79+
password: ${{ secrets.DOCKER_PAT}}
80+
81+
- name: Package and Push Helm chart
82+
run: |
83+
# Use version from previous step
84+
VERSION=${{ steps.bump_version.outputs.version }}
85+
echo "Chart version: $VERSION"
86+
87+
# Package the chart
88+
helm package ./helm/temporal-worker-controller
89+
90+
# Push to Docker Hub
91+
helm push temporal-worker-controller-${VERSION}.tgz oci://docker.io/temporalio/helm-charts
92+
93+
echo "✅ Chart pushed successfully to oci://docker.io/temporalio/helm-charts/temporal-worker-controller:${VERSION}"

.github/workflows/publish-main-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
18+
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
2121

.github/workflows/release.yml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919

@@ -40,3 +40,74 @@ jobs:
4040
args: release
4141
env:
4242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
helm:
45+
needs: release
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Configure Git
54+
run: |
55+
git config user.name "$GITHUB_ACTOR"
56+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
57+
58+
- name: Install Helm
59+
uses: azure/setup-helm@v3
60+
with:
61+
version: v3.12.0
62+
63+
- name: Login to Docker Hub
64+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
65+
with:
66+
registry: docker.io
67+
username: ${{ secrets.DOCKER_USERNAME }}
68+
password: ${{ secrets.DOCKER_PAT}}
69+
70+
- name: Bump Helm Chart Version
71+
id: bump_version
72+
run: |
73+
# Get current version from Chart.yaml
74+
CURRENT_VERSION=$(grep 'version:' helm/temporal-worker-controller/Chart.yaml | awk '{print $2}')
75+
echo "Current version: $CURRENT_VERSION"
76+
77+
# Split version into parts
78+
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
79+
MAJOR=${VERSION_PARTS[0]}
80+
MINOR=${VERSION_PARTS[1]}
81+
PATCH=${VERSION_PARTS[2]}
82+
83+
MINOR=$((MINOR + 1))
84+
PATCH=0
85+
86+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
87+
echo "New version: $NEW_VERSION"
88+
89+
# Update Chart.yaml with new version and appVersion
90+
sed -i "s/version: .*/version: $NEW_VERSION/" helm/temporal-worker-controller/Chart.yaml
91+
sed -i "s/appVersion: .*/appVersion: $GITHUB_REF_NAME/" helm/temporal-worker-controller/Chart.yaml
92+
93+
# Set output variable for use in later steps
94+
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
95+
96+
# Commit the change
97+
git add helm/temporal-worker-controller/Chart.yaml
98+
git commit -m "Bump chart version to $NEW_VERSION [skip ci]"
99+
git push
100+
101+
- name: Package and Push Helm chart
102+
run: |
103+
# Use version from previous step
104+
VERSION=${{ steps.bump_version.outputs.version }}
105+
echo "Chart version: $VERSION"
106+
107+
# Package the chart
108+
helm package ./helm/temporal-worker-controller
109+
110+
# Push to Docker Hub
111+
helm push temporal-worker-controller-${VERSION}.tgz oci://docker.io/temporalio/helm-charts
112+
113+
echo "✅ Chart pushed successfully to oci://docker.io/temporalio/helm-charts/temporal-worker-controller:${VERSION}"

helm/temporal-worker-controller/templates/manager.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ spec:
4747
{{- end }}
4848
containers:
4949
- name: manager
50-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
50+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
5151
imagePullPolicy: {{ .Values.image.pullPolicy }}
5252
command:
5353
- /manager
5454
env:
5555
- name: CONTROLLER_IDENTITY
5656
value: "{{ .Release.Name }}/{{ .Release.Namespace }}"
5757
- name: CONTROLLER_VERSION
58-
value: "{{ .Values.image.tag }}"
58+
value: "{{ .Values.image.tag | default .Chart.AppVersion }}"
5959
args:
6060
- --leader-elect
6161
{{- if .Values.metrics.enabled }}

helm/temporal-worker-controller/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
image:
22
repository: temporal-worker-controller
3-
tag: latest
3+
tag: "" # Defaults to Chart.appVersion if not specified
44
pullPolicy: IfNotPresent
55

66
podAnnotations: {}

0 commit comments

Comments
 (0)