Skip to content

Fix release pipeline: CR stripping, regex fix, step reordering, shell safety - #239

Merged
AndreasIgel merged 4 commits into
mainfrom
feature/improving-release-process
Aug 9, 2026
Merged

Fix release pipeline: CR stripping, regex fix, step reordering, shell safety#239
AndreasIgel merged 4 commits into
mainfrom
feature/improving-release-process

Conversation

@AndreasIgel

Copy link
Copy Markdown
Collaborator

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:

  1. Regex validation failed on CImvn help:evaluate can emit trailing carriage returns or whitespace on CI runners, causing the semver regex to fail even for valid versions like 0.5.0.

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

  3. Shell injection risk${{ steps.commit.outputs.has_changes }} was interpolated directly into shell code via if [ "${{ ... }}" = "true" ].

  4. Inconsistent $GITHUB_OUTPUT quoting — Some echo >> $GITHUB_OUTPUT lines were unquoted.

Changes

.github/workflows/maven-central-release.yml (only changed file)

  • CR/whitespace stripping: Strip \r and spaces from CURRENT_VERSION after mvn help:evaluate, before any validation. This fixes the regex failure on CI.
  • Regex fix: [0-9A-Za-z.-][0-9A-Za-z+.-] in the build metadata character class (allows + within build metadata per GitHub's suggestion).
  • Step reordering:
    • Old order: Attest → Next snapshot → Push → PR → GitHub Release
    • New order: Attest → Push branch + tagCreate GitHub ReleaseNext snapshot (force-push) → PR
    • This ensures the tag, branch, and GitHub Release are on the remote before the next-snapshot step runs. If the next-snapshot step fails, the release is already complete; only the snapshot bump and PR would need manual follow-up.
  • Shell safety: Replaced if [ "${{ steps.commit.outputs.has_changes }}" = "true" ] with env: HAS_CHANGES: ${{ ... }} + if [ "$HAS_CHANGES" = "true" ] (recommended pattern to avoid shell injection).
  • Quoting: All >> $GITHUB_OUTPUT occurrences now use >> "$GITHUB_OUTPUT".
  • Removed dead PATCH variable from next-snapshot computation (was computed but never used).
  • Removed unused HAS_CHANGES env from the next-snapshot step (the if condition already handles the check).

Verification

  • YAML validated with yaml.safe_load()
  • mvn clean install passes — all 5 modules, all tests green
  • Step order confirmed: 15 steps, push+release before next-snapshot
  • No conflict markers remain after merge with origin/main
  • Only .github/workflows/maven-central-release.yml differs from main (84 insertions, 68 deletions)

AndreasIgel and others added 4 commits August 8, 2026 15:00
…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>
@AndreasIgel
AndreasIgel merged commit eca5abe into main Aug 9, 2026
5 checks passed
@AndreasIgel
AndreasIgel deleted the feature/improving-release-process branch August 9, 2026 08:36
@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant