Skip to content

Commit 7dfa49d

Browse files
committed
Add release workflow and docs
Signed-off-by: Jakub Stejskal <xstejs24@gmail.com> # Conflicts: # .github/workflows/test-dependencies.yml # .github/workflows/test-integrations.yml
1 parent fbdfbc6 commit 7dfa49d

5 files changed

Lines changed: 174 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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.'
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+
if [[ ! "$BRANCH" =~ ^release-([0-9]+)\.x$ ]]; then
26+
echo "::error::Must run on a release-X.x branch (e.g., release-1.x)"
27+
exit 1
28+
fi
29+
echo "major=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
30+
31+
- name: Checkout
32+
uses: actions/checkout@v6
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Determine version
37+
id: version
38+
env:
39+
MAJOR: ${{ steps.branch.outputs.major }}
40+
run: |
41+
if [[ -n "${{ inputs.version }}" ]]; then
42+
VERSION="${{ inputs.version }}"
43+
if [[ ! "$VERSION" =~ ^${MAJOR}\.[0-9]+$ ]]; then
44+
echo "::error::Version $VERSION does not match branch major version $MAJOR"
45+
exit 1
46+
fi
47+
else
48+
LATEST=$(git tag -l "v${MAJOR}.*" --sort=-v:refname | head -n1)
49+
if [[ -z "$LATEST" ]]; then
50+
VERSION="${MAJOR}.0"
51+
else
52+
MINOR="${LATEST##*.}"
53+
VERSION="${MAJOR}.$((MINOR + 1))"
54+
fi
55+
fi
56+
TAG="v$VERSION"
57+
if git rev-parse "refs/tags/$TAG" &>/dev/null; then
58+
echo "::error::Tag $TAG already exists"
59+
exit 1
60+
fi
61+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
62+
echo "Releasing: $TAG"
63+
64+
- name: Create and push tag
65+
env:
66+
TAG: ${{ steps.version.outputs.tag }}
67+
run: |
68+
git tag "$TAG"
69+
git push origin "$TAG"
70+
71+
- name: Update floating major tag
72+
env:
73+
TAG: ${{ steps.version.outputs.tag }}
74+
MAJOR: ${{ steps.branch.outputs.major }}
75+
run: |
76+
git tag -f "v${MAJOR}" "$TAG"
77+
git push origin "v${MAJOR}" --force
78+
79+
- name: Generate release notes and create release
80+
env:
81+
GH_TOKEN: ${{ github.token }}
82+
TAG: ${{ steps.version.outputs.tag }}
83+
MAJOR: ${{ steps.branch.outputs.major }}
84+
run: |
85+
PREV_TAG=$(git tag -l "v${MAJOR}.*" --sort=-v:refname | grep -v "^${TAG}$" | head -n1)
86+
87+
API_ARGS=(-f tag_name="$TAG")
88+
if [[ -n "$PREV_TAG" ]]; then
89+
API_ARGS+=(-f previous_tag_name="$PREV_TAG")
90+
fi
91+
AUTO_NOTES=$(gh api repos/${{ github.repository }}/releases/generate-notes \
92+
"${API_ARGS[@]}" --jq '.body')
93+
94+
DESCRIPTION="${{ inputs.description }}"
95+
if [[ -n "$DESCRIPTION" ]]; then
96+
printf '%s\n\n---\n\n%s' "$DESCRIPTION" "$AUTO_NOTES" > release-notes.md
97+
else
98+
echo "$AUTO_NOTES" > release-notes.md
99+
fi
100+
101+
gh release create "$TAG" \
102+
--title "$TAG" \
103+
--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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ jobs:
153153

154154
## Versioning
155155

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.
156+
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.
157+
Releases are created from `release-X.x` branches using an automated workflow.
158+
See [RELEASE.md](RELEASE.md) for full details on the versioning scheme and release process.
159159

160160
> [!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!
161+
> 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.
162+
> This must be honored by every change made after the first release.
163163

164164
## License
165165

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. |
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)