Fix release pipeline: CR stripping, regex fix, step reordering, shell safety - #239
Merged
Conversation
…p next snapshot The release workflow had three issues that could cause incorrect releases or a broken reactor build: 1. The release version came from a manual workflow_dispatch input with no cross-check against the current POM version. A typo (e.g. entering 0.4.0 when the POM is at 0.5.0-SNAPSHOT) would release the wrong version. The input is now removed entirely; the workflow reads the POM version, verifies it is a -SNAPSHOT, and strips the suffix to derive the release version. 2. Only core and processor POMs were version-updated, but the reactor build (mvn verify with no -pl) includes example and example-custom-generator. The version mismatch could cause build failures or incorrect dependency resolution. All four modules are now updated together; only core and processor are still deployed to Maven Central. 3. After a release, main was left on the release version (e.g. 0.5.0) with no next-snapshot bump. A new "Prepare next snapshot version" step now computes the next minor snapshot (0.5.0 -> 0.6.0-SNAPSHOT), sets all POMs, and commits it as a second commit on the release branch. The git tag points to the first commit (release version), so it is unaffected. Both commits reach main via the same pull request. Additionally, the groupId of the example modules is unified to org.javahelpers.simple.builders (was io.github.java-helpers for example and org.javahelpers.simple.builders.example for example-custom-generator). Java package names are unchanged. RELEASE.md is updated to match the actual workflow behavior. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fix release pipeline: CR stripping, regex fix, step reordering, shell safety
Problem
The release workflow merged in #236 had several issues that could cause failures on GitHub Actions or leave the release in an inconsistent state:
Regex validation failed on CI —
mvn help:evaluatecan emit trailing carriage returns or whitespace on CI runners, causing the semver regex to fail even for valid versions like0.5.0.Step ordering risk — The "Prepare next snapshot version" step ran before "Push release branch and tag" and "Create GitHub Release". If the next-snapshot step failed, the tag, branch, and GitHub Release would never be pushed/created — even though artifacts were already deployed to Maven Central.
Shell injection risk —
${{ steps.commit.outputs.has_changes }}was interpolated directly into shell code viaif [ "${{ ... }}" = "true" ].Inconsistent
$GITHUB_OUTPUTquoting — Someecho >> $GITHUB_OUTPUTlines were unquoted.Changes
.github/workflows/maven-central-release.yml(only changed file)\rand spaces fromCURRENT_VERSIONaftermvn help:evaluate, before any validation. This fixes the regex failure on CI.[0-9A-Za-z.-]→[0-9A-Za-z+.-]in the build metadata character class (allows+within build metadata per GitHub's suggestion).if [ "${{ steps.commit.outputs.has_changes }}" = "true" ]withenv: HAS_CHANGES: ${{ ... }}+if [ "$HAS_CHANGES" = "true" ](recommended pattern to avoid shell injection).>> $GITHUB_OUTPUToccurrences now use>> "$GITHUB_OUTPUT".PATCHvariable from next-snapshot computation (was computed but never used).HAS_CHANGESenv from the next-snapshot step (theifcondition already handles the check).Verification
yaml.safe_load()mvn clean installpasses — all 5 modules, all tests greenorigin/main.github/workflows/maven-central-release.ymldiffers frommain(84 insertions, 68 deletions)