Skip to content

Commit ccfe3ed

Browse files
Update RELEASING.md to document automated version updates
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent eeff598 commit ccfe3ed

1 file changed

Lines changed: 55 additions & 6 deletions

File tree

RELEASING.md

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,18 @@ Once you trigger the workflow, the "Manual Draft Release" workflow will:
5151
- Create the release tag (e.g., v1.2.0) pointing to the release commit
5252
- Update `pom.xml` files to the next SNAPSHOT version (e.g., 1.2.1-SNAPSHOT)
5353
- Commit the next development iteration
54-
5.**Run Maven release:perform** to:
54+
5.**Update example version numbers in documentation**:
55+
- Automatically update version numbers in README.md dependency examples
56+
- Amend the release commit to include documentation updates
57+
- Update the tag to point to the amended commit
58+
- Ensures documentation examples always match the release version
59+
6.**Run Maven release:perform** to:
5560
- Check out the release tag
5661
- Build and test the release version
5762
- Deploy artifacts to Maven Central with GPG signatures
58-
6. ✅ Push commits and tag back to the target branch
59-
7. ✅ Upload release artifacts (JAR files) to the draft release
60-
8. ✅ Publish the GitHub Release (remove draft status)
63+
7. ✅ Push commits and tag back to the target branch
64+
8. ✅ Upload release artifacts (JAR files) to the draft release
65+
9. ✅ Publish the GitHub Release (remove draft status)
6166

6267
**Workflow Diagram:**
6368
```
@@ -81,6 +86,12 @@ Workflow: Runs release:prepare on main branch
8186
- Creates tag v1.2.0 → commit A
8287
- Commit B: pom.xml → 1.2.1-SNAPSHOT (next dev version)
8388
89+
Workflow: Updates example versions in documentation
90+
91+
- Updates README.md with version 1.2.0
92+
- Amends Commit A to include documentation updates
93+
- Updates tag v1.2.0 → amended Commit A
94+
8495
Workflow: Runs release:perform
8596
8697
- Checks out tag v1.2.0 (commit A)
@@ -107,12 +118,15 @@ Result:
107118
1. Check the [Actions tab](https://github.com/BerryCloud/xapi-java/actions) to ensure the workflow completed successfully
108119
- The workflow will show a summary of the release including version, tag, and status
109120
2. Verify the target branch (e.g., `main`) has two new commits:
110-
- Release commit: `[maven-release-plugin] prepare release vX.Y.Z`
121+
- Release commit: `[maven-release-plugin] prepare release vX.Y.Z` (includes documentation updates)
111122
- Development commit: `[maven-release-plugin] prepare for next development iteration`
112123
3. Verify the GitHub Release was published at the [Releases page](https://github.com/BerryCloud/xapi-java/releases)
113124
- The release should no longer be in draft state
114125
- JAR artifacts should be attached to the release
115-
4. Verify artifacts are available on [Maven Central](https://central.sonatype.com/artifact/dev.learning.xapi/xapi-model)
126+
4. Verify documentation examples were updated:
127+
- Check that README.md contains the correct version in dependency examples
128+
- The version should match the release version (e.g., 1.2.0)
129+
5. Verify artifacts are available on [Maven Central](https://central.sonatype.com/artifact/dev.learning.xapi/xapi-model)
116130
- Note: It may take up to 2 hours for artifacts to sync to Maven Central
117131

118132
## Manual Draft Release Benefits
@@ -125,6 +139,7 @@ The manual draft release approach provides several advantages:
125139
- **Release Notes**: Prepare release notes in advance as part of the draft
126140
- **Artifact Attachment**: Release artifacts (JARs) are automatically uploaded to the GitHub Release
127141
- **Coordination**: Coordinate releases with code reviews and team schedules
142+
- **Automated Documentation**: Version numbers in documentation examples are automatically updated to match the release version
128143

129144
## Release Branch Strategy
130145

@@ -138,6 +153,40 @@ The manual draft release approach provides several advantages:
138153
- Used for reproducible builds and deployments
139154
- **No separate release branches**: The release workflow pushes directly to the selected branch
140155

156+
## Automated Documentation Version Updates
157+
158+
The release workflow automatically updates version numbers in documentation examples to match the release version. This ensures users always see correct, up-to-date version numbers when copying examples from the documentation.
159+
160+
### What Gets Updated
161+
162+
The automation updates version numbers in:
163+
- **README.md**: All Maven dependency examples for xapi-client, xapi-model, and xapi-model-spring-boot-starter
164+
165+
### How It Works
166+
167+
1. After Maven release:prepare completes, a script (`.github/scripts/update-example-versions.sh`) runs automatically
168+
2. The script extracts the release version from the root `pom.xml`
169+
3. It updates all `<version>X.Y.Z</version>` tags within dependency blocks in README.md
170+
4. The changes are added to the release commit (amending the commit created by release:prepare)
171+
5. The release tag is updated to point to the amended commit
172+
173+
### Benefits
174+
175+
- **No manual updates needed**: Version numbers are updated automatically during release
176+
- **Always accurate**: Documentation examples always reference the current release version
177+
- **Transparent**: Changes appear in the release commit and are visible in pull requests
178+
- **Single source of truth**: Uses Maven's version from pom.xml as the authoritative source
179+
180+
### Maintenance
181+
182+
The script uses simple pattern matching to find and replace version numbers. If new files need to be updated:
183+
184+
1. Edit `.github/scripts/update-example-versions.sh`
185+
2. Add the file path to the `FILES_TO_UPDATE` array
186+
3. Commit the change
187+
188+
The script will automatically update all listed files in future releases.
189+
141190
## Advanced Options
142191

143192
### Editing Draft Releases

0 commit comments

Comments
 (0)