Skip to content

Commit 222abe7

Browse files
authored
✨ simplify release process and operator image tag handling (#1444)
* ✨ enhance: simplify release workflow and update documentation for version preparation * ✨ enhance: simplify image tag handling in values and templates for the operator
1 parent fb35cc4 commit 222abe7

5 files changed

Lines changed: 77 additions & 50 deletions

File tree

.github/workflows/release.yaml

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Copyright (c) Mondoo, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
name: Release
4+
name: Prepare Release
55

66
on:
7-
release:
8-
types: [created]
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: "Release version (e.g., 13.0.2) — without the 'v' prefix"
11+
required: true
12+
type: string
913

1014
jobs:
1115
prepare-release:
1216
runs-on: ubuntu-latest
13-
# Only run for stable version tags (skip pre-releases like v1.0.0-alpha.1)
14-
if: startsWith(github.event.release.tag_name, 'v') && !contains(github.event.release.tag_name, '-')
1517
permissions:
1618
contents: write
19+
pull-requests: write
1720

1821
steps:
1922
- name: Checkout main branch
@@ -36,13 +39,14 @@ jobs:
3639
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
3740
sudo chmod +x /usr/local/bin/yq
3841
39-
- name: Extract version from tag
42+
- name: Set version
4043
id: version
4144
run: |
42-
TAG="${{ github.event.release.tag_name }}"
43-
VERSION="${TAG#v}"
45+
VERSION="${{ inputs.version }}"
46+
# Strip leading 'v' if accidentally included
47+
VERSION="${VERSION#v}"
4448
echo "version=${VERSION}" >> $GITHUB_OUTPUT
45-
echo "tag=${TAG}" >> $GITHUB_OUTPUT
49+
echo "tag=v${VERSION}" >> $GITHUB_OUTPUT
4650
4751
- name: Update version files
4852
run: |
@@ -65,30 +69,40 @@ jobs:
6569
git config user.name "github-actions[bot]"
6670
git config user.email "github-actions[bot]@users.noreply.github.com"
6771
68-
- name: Commit version updates
69-
id: commit
72+
- name: Create release branch and PR
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7075
run: |
7176
VERSION="${{ steps.version.outputs.version }}"
77+
TAG="${{ steps.version.outputs.tag }}"
78+
BRANCH="release/${TAG}"
7279
80+
git checkout -b "${BRANCH}"
7381
git add -A
7482
if git diff --staged --quiet; then
75-
echo "No changes to commit"
76-
echo "changed=false" >> $GITHUB_OUTPUT
77-
else
78-
git commit -m "🚀 Release v${VERSION}"
79-
git push origin main
80-
echo "changed=true" >> $GITHUB_OUTPUT
83+
echo "No changes to commit — version files are already up to date"
84+
exit 0
8185
fi
8286
83-
- name: Move tag to include version updates
84-
if: steps.commit.outputs.changed == 'true'
85-
run: |
86-
TAG="${{ steps.version.outputs.tag }}"
87+
git commit -m "🚀 Release ${TAG}"
88+
git push origin "${BRANCH}"
89+
90+
gh pr create \
91+
--title "🚀 Release ${TAG}" \
92+
--body "$(cat <<EOF
93+
## Release ${TAG}
94+
95+
This PR updates version files for the ${TAG} release.
8796
88-
# Delete the old tag (local and remote)
89-
git tag -d "${TAG}" || true
90-
git push origin ":refs/tags/${TAG}" || true
97+
### Changed files
98+
- \`charts/mondoo-operator/Chart.yaml\` — version and appVersion → ${VERSION}
99+
- \`config/manager/kustomization.yaml\` — image tag → ${TAG}
100+
- Generated manifests and Helm CRDs
91101
92-
# Create new tag at current HEAD (which includes version updates)
93-
git tag "${TAG}"
94-
git push origin "${TAG}"
102+
### After merging
103+
[Create a new GitHub Release](https://github.com/${{ github.repository }}/releases/new?tag=${TAG}&target=main&title=${TAG}) with tag \`${TAG}\` targeting \`main\`.
104+
The **Publish** workflow will then build and push container images and the Helm chart.
105+
EOF
106+
)" \
107+
--base main \
108+
--head "${BRANCH}"

RELEASE.md

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,53 @@
11
# Operator Release
22

3-
## Automated Release Process
3+
## Release Process
44

5-
Releases are fully automated via GitHub Actions.
5+
Releases follow a two-step process: first prepare the version bump via PR, then create the GitHub Release.
66

7-
### To Release a New Version:
7+
### Step 1: Prepare the Release
8+
9+
1. Go to **Actions** > **Prepare Release** workflow
10+
2. Select **Run workflow**
11+
3. Enter the version number (e.g., `13.0.2`) — without the `v` prefix
12+
4. Select **Run workflow**
13+
14+
The workflow will:
15+
- Create a `release/v13.0.2` branch
16+
- Update version in `Chart.yaml` and `kustomization.yaml`
17+
- Regenerate Helm chart CRDs and manifests
18+
- Open a PR titled "Release v13.0.2"
19+
20+
5. Review and merge the PR
21+
22+
### Step 2: Create the GitHub Release
823

924
1. Go to the repository's **Releases** page
1025
2. Select **Draft a new release**
11-
3. Select **Choose a tag** and type the new version (e.g., `v12.1.0`)
12-
4. Select **Create new tag: v12.1.0 on publish**
13-
5. Set the release title (e.g., `v12.1.0`)
14-
6. Optionally add release notes describing the changes
15-
7. Select **Publish release**
16-
17-
The release workflow will automatically:
18-
- Update version in Chart.yaml and kustomization.yaml
19-
- Regenerate Helm chart and manifests
20-
- Commit changes to main
21-
- Move the tag to include version updates
22-
- Trigger container image builds (multi-arch)
26+
3. Select **Choose a tag** and type the new version (e.g., `v13.0.2`)
27+
4. Set the **Target** to `main`
28+
5. Select **Create new tag: v13.0.2 on publish**
29+
6. Set the release title (e.g., `v13.0.2`)
30+
7. Optionally add release notes describing the changes
31+
8. Select **Publish release**
32+
33+
The publish workflow will automatically:
34+
- Build multi-arch container images
2335
- Publish Helm chart to GitHub Pages and OCI registry
2436
- Update the GitHub release with manifest files
2537

2638
### Versioning
2739

2840
Follow [semantic versioning](https://semver.org/):
29-
- **Patch** (12.0.X): Bug fixes, no breaking changes
30-
- **Minor** (12.X.0): New features, backwards compatible
41+
- **Patch** (13.0.X): Bug fixes, no breaking changes
42+
- **Minor** (13.X.0): New features, backwards compatible
3143
- **Major** (X.0.0): Breaking changes (see [upgrade docs](docs/operator-upgrades.md))
3244

3345
### Pre-Releases
3446

3547
For alpha, beta, or release candidate versions:
3648

3749
1. Follow the same release process above
38-
2. Use semver pre-release format: `v12.1.0-alpha.1`, `v12.1.0-rc.1`
50+
2. Use semver pre-release format: `v13.1.0-alpha.1`, `v13.1.0-rc.1`
3951
3. **Check the "Set as a pre-release" checkbox** in GitHub Release UI
4052

4153
Pre-releases will:
@@ -44,7 +56,8 @@ Pre-releases will:
4456
- **NOT** update the "latest" Docker tag
4557
- **NOT** be marked as the latest GitHub release
4658

47-
Users can deploy a specific pre-release by specifying the version explicitly.
59+
Note: The "Prepare Release" workflow skips pre-release versions (those containing `-`).
60+
For pre-releases, use the manual process below to bump versions if needed.
4861

4962
### Manual Release (Emergency)
5063

charts/mondoo-operator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ helm uninstall mondoo-operator --namespace mondoo-operator
3737
| `controllerManager.manager.args` | Command-line arguments passed to the operator manager container | `["operator","--health-probe-bind-address=:8081","--metrics-bind-address=:8080","--leader-elect"]` |
3838
| `controllerManager.manager.containerSecurityContext` | Security context for the manager container | `{}` |
3939
| `controllerManager.manager.image.repository` | Container image repository for the operator | `ghcr.io/mondoohq/mondoo-operator` |
40-
| `controllerManager.manager.image.tag` | Container image tag for the operator | `v12.0.1` |
40+
| `controllerManager.manager.image.tag` | Container image tag for the operator (defaults to .Chart.AppVersion) | `""` |
4141
| `controllerManager.manager.imagePullPolicy` | Image pull policy for the operator container | `IfNotPresent` |
4242
| `controllerManager.manager.resources` | Resource requests and limits for the manager container | `{}` |
4343
| `controllerManager.podSecurityContext` | Pod-level security context for the controller manager | `{}` |

charts/mondoo-operator/templates/pre-delete-hook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ spec:
8383
type: RuntimeDefault
8484
containers:
8585
- name: cleanup
86-
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag }}
86+
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag | default .Chart.AppVersion }}
8787
imagePullPolicy: {{ .Values.controllerManager.manager.imagePullPolicy }}
8888
args:
8989
- cleanup

charts/mondoo-operator/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ controllerManager:
2020
image:
2121
## @param controllerManager.manager.image.repository Container image repository for the operator
2222
repository: ghcr.io/mondoohq/mondoo-operator
23-
## @param controllerManager.manager.image.tag Container image tag for the operator
24-
tag: v12.0.1
23+
## @param controllerManager.manager.image.tag Container image tag for the operator (defaults to .Chart.AppVersion)
24+
tag: ""
2525
## @param controllerManager.manager.imagePullPolicy Image pull policy for the operator container
2626
imagePullPolicy: IfNotPresent
2727
## @param controllerManager.manager.resources [object] Resource requests and limits for the manager container

0 commit comments

Comments
 (0)