Skip to content

Commit 300c2c6

Browse files
authored
Add release workflow and docs (#21)
* Add release workflow and docs Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Add debug log Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Add support note into readme Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> * Update info about version format input Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> --------- Signed-off-by: Jakub Stejskal <xstejs24@gmail.com>
1 parent fbdfbc6 commit 300c2c6

5 files changed

Lines changed: 180 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g., 1.3). Leave empty to auto-increment minor. Do not add `v` into version name as it is prepended automatically.'
8+
required: false
9+
type: string
10+
description:
11+
description: 'Custom release description (prepended before auto-generated changelog).'
12+
required: false
13+
type: string
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: Validate branch
22+
id: branch
23+
run: |
24+
BRANCH="${{ github.ref_name }}"
25+
26+
echo "Validating branch: ${BRANCH}"
27+
if [[ ! "$BRANCH" =~ ^release-([0-9]+)\.x$ ]]; then
28+
echo "::error::Must run on a release-X.x branch (e.g., release-1.x)"
29+
exit 1
30+
fi
31+
echo "major=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
32+
33+
- name: Checkout
34+
uses: actions/checkout@v6
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Determine version
39+
id: version
40+
env:
41+
MAJOR: ${{ steps.branch.outputs.major }}
42+
run: |
43+
if [[ -n "${{ inputs.version }}" ]]; then
44+
VERSION="${{ inputs.version }}"
45+
if [[ ! "$VERSION" =~ ^${MAJOR}\.[0-9]+$ ]]; then
46+
echo "::error::Version $VERSION does not match branch major version $MAJOR"
47+
exit 1
48+
fi
49+
else
50+
LATEST=$(git tag -l "v${MAJOR}.*" --sort=-v:refname | head -n1)
51+
if [[ -z "$LATEST" ]]; then
52+
VERSION="${MAJOR}.0"
53+
else
54+
MINOR="${LATEST##*.}"
55+
VERSION="${MAJOR}.$((MINOR + 1))"
56+
fi
57+
fi
58+
TAG="v$VERSION"
59+
if git rev-parse "refs/tags/$TAG" &>/dev/null; then
60+
echo "::error::Tag $TAG already exists"
61+
exit 1
62+
fi
63+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
64+
echo "Releasing: $TAG"
65+
66+
- name: Create and push tag
67+
env:
68+
TAG: ${{ steps.version.outputs.tag }}
69+
run: |
70+
git tag "$TAG"
71+
git push origin "$TAG"
72+
73+
- name: Update floating major tag
74+
env:
75+
TAG: ${{ steps.version.outputs.tag }}
76+
MAJOR: ${{ steps.branch.outputs.major }}
77+
run: |
78+
git tag -f "v${MAJOR}" "$TAG"
79+
git push origin "v${MAJOR}" --force
80+
81+
- name: Generate release notes and create release
82+
env:
83+
GH_TOKEN: ${{ github.token }}
84+
TAG: ${{ steps.version.outputs.tag }}
85+
MAJOR: ${{ steps.branch.outputs.major }}
86+
run: |
87+
PREV_TAG=$(git tag -l "v${MAJOR}.*" --sort=-v:refname | grep -v "^${TAG}$" | head -n1)
88+
89+
API_ARGS=(-f tag_name="$TAG")
90+
if [[ -n "$PREV_TAG" ]]; then
91+
API_ARGS+=(-f previous_tag_name="$PREV_TAG")
92+
fi
93+
AUTO_NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes \
94+
"${API_ARGS[@]}" --jq '.body')
95+
96+
DESCRIPTION="${{ inputs.description }}"
97+
if [[ -n "$DESCRIPTION" ]]; then
98+
printf '%s\n\n---\n\n%s' "$DESCRIPTION" "$AUTO_NOTES" > release-notes.md
99+
else
100+
echo "$AUTO_NOTES" > release-notes.md
101+
fi
102+
103+
gh release create "$TAG" \
104+
--title "$TAG" \
105+
--notes-file release-notes.md

.github/workflows/test-dependencies.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ on:
88
branches:
99
- "main"
1010
- "release-*"
11-
tags:
12-
- "*"
1311

1412
# Declare default permissions as read only
1513
permissions:

.github/workflows/test-integrations.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ on:
88
branches:
99
- "main"
1010
- "release-*"
11-
tags:
12-
- "*"
1311

1412
# Declare default permissions as read only
1513
permissions:

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
Shared GitHub Actions and CI workflows used across [Strimzi](https://strimzi.io/) repositories.
1010

11+
> [!IMPORTANT]
12+
> All the actions within this repository are designed for internal usage within Strimzi projects.
13+
> We do not support usage of the actions outside the Strimzi organization.
14+
1115
## Actions
1216

1317
### Dependency Actions
@@ -153,13 +157,13 @@ jobs:
153157

154158
## Versioning
155159

156-
Once we will agree that actions are in stable state we will create first branch/tag to freeze the state.
157-
This branch/tag will be then used in other repositories to freeze actions version to avoid potential issues with failures.
158-
At this point, each repository should implement the testing workflow described above.
160+
This repository uses `vX.Y` release tags (e.g., `v1.0`, `v1.3`) with floating `vX` major tags that always point to the latest release within a major version.
161+
Releases are created from `release-X.x` branches using an automated workflow.
162+
See [RELEASE.md](RELEASE.md) for full details on the versioning scheme and release process.
159163

160164
> [!WARNING]
161-
> To ensure that actions will remain functional across the whole project, we have to ensure compatibility between N and N-1 versions of github-actions repository.
162-
> This has to be honored by every change done after the first branch/tag (release) freeze!
165+
> To ensure that actions remain functional across all Strimzi projects, compatibility between N and N-1 versions of the `github-actions` repository must be maintained.
166+
> This must be honored by every change made after the first release.
163167

164168
## License
165169

RELEASE.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Release Process
2+
3+
This document describes the versioning scheme and release process for the `strimzi/github-actions` repository.
4+
5+
## Versioning Scheme
6+
7+
| Concept | Format | Example | Description |
8+
|--------------------|---------------|----------------|-----------------------------------------------------|
9+
| Release tag | `vX.Y` | `v1.0`, `v1.3` | Immutable tag pointing to a specific release commit |
10+
| Floating major tag | `vX` | `v1`, `v2` | Always points to the latest `vX.Y` release |
11+
| Release branch | `release-X.x` | `release-1.x` | Branch for a major version series |
12+
13+
We will then pin to a specific version (`v1.2`) for full reproducibility, or use the floating major tag (`v1`) to automatically get the latest patch within a major version.
14+
15+
## Creating a Release Branch
16+
17+
Before the first release of a new major version, create a release branch from `main`:
18+
19+
```bash
20+
git checkout main
21+
git pull
22+
git checkout -b release-1.x
23+
git push origin release-1.x
24+
```
25+
26+
Once you will push the changes, the tests will be automatically triggered and can be review in Actions UI or in commits list.
27+
28+
## Running the Release Workflow
29+
30+
The release is performed via the **Release** workflow (`release.yml`), triggered manually using `workflow_dispatch` on a `release-X.x` branch.
31+
32+
### Inputs
33+
34+
| Input | Required | Description |
35+
|---------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
36+
| `version` | No | Release version (e.g., `1.3`). If empty, the minor version is auto-incremented from the latest `vX.Y` tag. Note that `v` is prepended autoamtically and shouldn't be in input string. |
37+
| `description` | No | Custom release description prepended before the auto-generated changelog. |
38+
39+
### Auto-increment behavior
40+
41+
When `version` is left empty, the workflow finds the latest `vX.Y` tag for the branch's major version and increments the minor number.
42+
If no tags exist yet, it starts at `X.0`.
43+
44+
### Steps to release
45+
46+
1. Go to **Actions** > **Release** in GitHub.
47+
2. Click **Run workflow**.
48+
3. Select the target `release-X.x` branch.
49+
4. Optionally enter a version and/or description.
50+
5. Click **Run workflow**.
51+
52+
### What the workflow does
53+
54+
1. **Validates** the branch matches the `release-X.x` pattern and extracts the major version.
55+
2. **Determines the version** — either from the manual input or by auto-incrementing.
56+
3. **Checks** that the tag does not already exist.
57+
4. **Creates and pushes** the `vX.Y` tag.
58+
5. **Force-updates** the floating `vX` tag to point to the same commit.
59+
6. **Generates release notes** using GitHub's auto-generated changelog, optionally prepended with a custom description.
60+
7. **Creates a GitHub Release** with the generated notes.
61+
62+
## Compatibility
63+
64+
> [!WARNING]
65+
> To ensure that actions remain functional across all Strimzi projects, compatibility between N and N-1 versions of the `github-actions` repository must be maintained.
66+
> This must be honored by every change made after the first release.

0 commit comments

Comments
 (0)