Skip to content

Commit 73eca6e

Browse files
committed
Review release process
Signed-off-by: Aurea Munoz <[email protected]>
1 parent 72c7f85 commit 73eca6e

File tree

3 files changed

+95
-50
lines changed

3 files changed

+95
-50
lines changed

.github/workflows/bump-version.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: Manual Version Bump to Next SNAPSHOT
22

33
on:
4-
# release:
5-
# types: [ created ]
4+
workflow_run:
5+
workflows: [ "Publish package to the Maven Central Repository" ]
6+
types:
7+
- completed
8+
branches:
9+
- main
610
workflow_dispatch:
7-
inputs:
8-
base_branch:
9-
description: 'Base branch for PR'
10-
required: false
11-
default: 'main'
1211

1312
jobs:
1413
bump-version:

.github/workflows/publish.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
name: Publish package to the Maven Central Repository
22

33
on:
4-
pull_request:
5-
types:
6-
- closed
7-
branches:
8-
- main
9-
workflow_dispatch:
10-
inputs:
11-
base_branch:
12-
description: 'Base branch for PR'
13-
required: false
14-
default: 'main'
4+
release:
5+
types: [published] # Triggered by a release publication
6+
workflow_dispatch: # Allows manual run if needed
157

168
jobs:
17-
# run_if:
18-
# if: startsWith(github.head_ref, 'bump-version-')
199
publish:
2010
runs-on: ubuntu-latest
2111
steps:
22-
- uses: actions/checkout@v5
12+
- name: Checkout repository at release tag
13+
uses: actions/checkout@v5
2314
with:
24-
ref: ${{ github.event.inputs.base_branch }}
15+
ref: ${{ github.event.release.tag_name }} # Uses the release tag
2516
fetch-depth: 0
2617
submodules: recursive
2718
- name: Set up JDK and Maven Settings
@@ -38,6 +29,29 @@ jobs:
3829
run: |
3930
gpg --list-keys
4031
32+
- name: Verify version matches release tag
33+
run: |
34+
POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
35+
TAG_VERSION=${{ github.event.release.tag_name }}
36+
# Remove 'v' prefix if present
37+
TAG_VERSION=${TAG_VERSION#v}
38+
39+
echo "POM version: $POM_VERSION"
40+
echo "Release tag: $TAG_VERSION"
41+
42+
if [ "$POM_VERSION" != "$TAG_VERSION" ]; then
43+
echo "❌ ERROR: Version mismatch!"
44+
echo "POM version ($POM_VERSION) does not match release tag ($TAG_VERSION)"
45+
exit 1
46+
fi
47+
48+
if [[ "$POM_VERSION" == *"SNAPSHOT"* ]]; then
49+
echo "❌ ERROR: Cannot publish SNAPSHOT version to Maven Central"
50+
exit 1
51+
fi
52+
53+
echo "✅ Version verification passed"
54+
4155
- name: Publish package
4256
run: mvn --batch-mode deploy -DskipTests -Prelease
4357
env:

README.md

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -115,51 +115,83 @@ you could do that by adding this entry to your application configuration:
115115
narayana.messaginghub.maxConnections=10
116116
```
117117

118-
# Release & Versioning Process
118+
# Release Process
119119

120-
This repository uses a two-step process for releasing artifacts to Maven Central
120+
This repository uses an automated two-step process for releasing artifacts to Maven Central.
121121

122-
## Step 1: Create a GitHub Release
122+
## Step 1: Prepare the Release Version
123123

124-
To start the release process:
124+
Before creating a GitHub Release, you need to manually prepare the release version:
125125

126-
1. Go to the **Releases** section in GitHub.
127-
2. Click **"Draft a new release"**.
128-
3. In the **Tag version** field, enter the release version (e.g., `v1.2.3`).
129-
4. Fill in the **Release title** and description if needed.
130-
5. Click **"Publish release"**.
126+
1. **Update the version in `pom.xml`** files:
127+
- Change from `X.Y.Z-SNAPSHOT` to `X.Y.Z` (remove the `-SNAPSHOT` suffix)
128+
- Example: `1.2.3-SNAPSHOT``1.2.3`
131129

132-
This will trigger the `Manual Version Bump to Next SNAPSHOT` GitHub Action.
130+
2. **Commit and push to main**:
131+
```bash
132+
git add pom.xml
133+
git commit -m "chore: prepare release X.Y.Z"
134+
git push origin main
135+
```
133136

137+
## Step 2: Create a GitHub Release
134138

135-
## What happens next?
139+
1. Go to the [Releases section](../../releases) in GitHub.
140+
2. Click **"Draft a new release"**.
141+
3. In the **Tag version** field, enter the release version (e.g., `1.2.3`).
142+
- ⚠️ **Important**: The tag must match the version in `pom.xml`.
143+
4. Fill in the **Release title** and **description**.
144+
5. Click **"Publish release"**.
136145

137-
1. The `Manual Version Bump to Next SNAPSHOT` workflow:
138-
- Calculates the next `-SNAPSHOT` version (e.g., `1.2.4-SNAPSHOT`).
139-
- Creates a new branch called bump-version-*
140-
- Updates the `pom.xml`.
141-
- Opens a Pull Request with the version bump.
146+
## What Happens Next?
142147

143-
## Next Step: Merge the PR
148+
### Automated Step 1: Publish to Maven Central
144149

145-
Once the Pull Request is created, manual action should be perform to:
150+
The `Publish package to the Maven Central Repository` is triggered. This workflow will automatically:
151+
- Checkout the code at the release tag
152+
- Verify that the `pom.xml` version matches the release tag
153+
- Verify that the version is not a `-SNAPSHOT`
154+
- Publish the release to Maven Central
146155

147-
1. Review the changes.
148-
2. If everything looks good, merge the PR.
149-
3. Your main branch will now be at the next `-SNAPSHOT` version, ready for development.
156+
### Automated Step 2: Bump to Next SNAPSHOT Version
150157

151-
This will trigger the `Publish package to the Maven Central Repository` GitHub Action.
158+
Once the publish workflow completes successfully, the `Manual Version Bump to Next SNAPSHOT` is triggered. This workflow will automatically:
159+
- Calculate the next `-SNAPSHOT` version (e.g., `1.2.4-SNAPSHOT`)
160+
- Create a new branch called `bump-version-X.Y.Z-SNAPSHOT`
161+
- Update the `pom.xml` with the new version
162+
- Open a Pull Request with the version bump
152163

153-
## Final step: Publish the release.
164+
## Step 3: Merge the Version Bump PR
154165

155-
The `Publish package to the Maven Central Repository` workflow publishes the current version to Maven Central (via `mvn deploy`).
166+
1. Review the automatically created Pull Request.
167+
2. If everything looks correct, **merge the PR**.
168+
3. Your `main` branch will now be at the next `-SNAPSHOT` version, ready for development.
156169

170+
## Complete Flow Diagram
171+
172+
```
173+
1. Manual: Update pom.xml (1.2.3-SNAPSHOT → 1.2.3)
174+
175+
2. Manual: Commit and push to main
176+
177+
3. Manual: Create GitHub Release with tag v1.2.3
178+
179+
4. Automated: Publish workflow verifies and publishes 1.2.3 to Maven Central
180+
181+
5. Automated: Bump-version workflow creates PR for 1.2.4-SNAPSHOT
182+
183+
6. Manual: Review and merge the PR
184+
185+
7. Done: main branch is now at 1.2.4-SNAPSHOT
186+
```
157187

158-
### Notes
188+
## Important Notes
159189

160-
- The tag created in the GitHub release must match the version being released.
161-
- The PR will be automatically created only if the `pom.xml` version changes.
162-
- The PR will be created with a branch called `bump-version-<next-version>`
190+
- ⚠️ The tag created in the GitHub release **must match** the version in `pom.xml` (e.g., tag `v1.2.3` for version `1.2.3`).
191+
- ⚠️ The version in `pom.xml` must **not** contain `-SNAPSHOT` when creating the release.
192+
- ✅ The publish workflow includes safety checks to prevent publishing incorrect versions.
193+
- ✅ The PR for the version bump will only be created if the publish workflow succeeds.
194+
- 🔧 Both workflows can also be triggered manually via `workflow_dispatch` if needed.
163195

164196

165197
## Snapshot & debug release job (Post-Sonatype Migration)

0 commit comments

Comments
 (0)