Skip to content

Commit 23fe0f2

Browse files
Simplify workflow: use Maven's automatic version calculation and remove cleanup step
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent b99b33c commit 23fe0f2

2 files changed

Lines changed: 2 additions & 44 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ jobs:
4040
VERSION="${TAG_NAME#v}"
4141
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4242
echo "Extracted version: $VERSION"
43-
44-
# Calculate next development version (increment patch version)
45-
IFS='.' read -ra VERSION_PARTS <<< "$VERSION"
46-
MAJOR="${VERSION_PARTS[0]}"
47-
MINOR="${VERSION_PARTS[1]}"
48-
PATCH="${VERSION_PARTS[2]}"
49-
NEXT_PATCH=$((PATCH + 1))
50-
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT"
51-
echo "next_version=${NEXT_VERSION}" >> $GITHUB_OUTPUT
52-
echo "Next development version: $NEXT_VERSION"
5343
5444
- name: Determine target branch
5545
id: target_branch
@@ -102,17 +92,15 @@ jobs:
10292
- name: Run Maven release:prepare
10393
run: |
10494
VERSION="${{ steps.validate_tag.outputs.version }}"
105-
NEXT_VERSION="${{ steps.validate_tag.outputs.next_version }}"
10695
TAG_NAME="${{ github.event.release.tag_name }}"
10796
10897
echo "Preparing release version: $VERSION"
109-
echo "Next development version: $NEXT_VERSION"
11098
echo "Tag name: $TAG_NAME"
11199
112-
# Run release:prepare with explicit versions
100+
# Run release:prepare with explicit release version
101+
# Maven will automatically calculate the next development version
113102
./mvnw -B release:prepare \
114103
-DreleaseVersion="${VERSION}" \
115-
-DdevelopmentVersion="${NEXT_VERSION}" \
116104
-Dtag="${TAG_NAME}" \
117105
-DpushChanges=false \
118106
-DremoteTagging=false
@@ -154,11 +142,3 @@ jobs:
154142
git push origin "$TAG_NAME"
155143
156144
echo "Pushed release commits and tag to $TARGET_BRANCH"
157-
158-
- name: Clean up
159-
if: always()
160-
run: |
161-
# Clean up Maven release artifacts
162-
rm -f release.properties pom.xml.releaseBackup
163-
find . -name "pom.xml.releaseBackup" -delete || true
164-
find . -name "pom.xml.tag" -delete || true

RELEASING.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ If the automated release workflow fails:
116116
| Missing secrets | Ensure GPG keys and Maven credentials are configured in repository secrets |
117117
| Build failures | Fix build issues on main branch first, then retry release |
118118
| Test failures | Fix failing tests on main branch first, then retry release |
119-
| Local branch already exists | Delete or rename your local branch before retrying. The automated workflow does not create separate release branches. |
120-
| Permission denied | Ensure workflow has `contents: write` permission |
121119

122120
4. **After fixing issues:**
123121
- Delete the failed release and tag in GitHub UI
@@ -131,26 +129,6 @@ If the automated release workflow fails:
131129
```
132130
- Create a new release with the same tag
133131

134-
### Re-releasing the Same Version
135-
136-
If you need to re-release the same version after a failed release:
137-
138-
1. Delete the existing release in GitHub UI:
139-
- Go to Releases → Click on the release → Delete release
140-
2. Delete the tag (locally and remotely):
141-
```bash
142-
git tag -d vX.Y.Z
143-
git push origin :refs/tags/vX.Y.Z
144-
```
145-
3. Reset the target branch if commits were pushed:
146-
```bash
147-
git fetch origin
148-
git checkout main # or your target branch
149-
git reset --hard origin/main~2 # Remove the 2 release commits if they exist
150-
git push -f origin main # Only if commits were pushed
151-
```
152-
4. Create a new release with the same version tag
153-
154132
### Workflow Stuck or Taking Too Long
155133

156134
The workflow typically takes 5-10 minutes. If it's taking longer:

0 commit comments

Comments
 (0)