Add automated maven central pubslishing#2
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces automated publishing to Maven Central driven by GitHub tag pushes, adding the Maven build configuration and CI workflow steps needed to produce source/javadoc artifacts and signed releases.
Changes:
- Adds a
releaseMaven profile to attach sources/javadocs and GPG-sign artifacts. - Documents tag conventions, workflow behavior, and required repository secrets in the README.
- Adds a GitHub Actions workflow to build, deploy, and create GitHub Releases on tag push.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
pom.xml |
Adds plugin versions and a release profile for sources/javadocs and GPG signing. |
README.md |
Adds publishing documentation (tag conventions, workflow steps, required secrets). |
.github/workflows/publish.yml |
New release workflow triggered by tags to set versions, build, deploy, and create GitHub Releases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Set project version from tag | ||
| run: | | ||
| mvn -B -ntp versions:set -DnewVersion="${{ steps.version.outputs.VERSION }}" |
There was a problem hiding this comment.
This step uses versions:set without -DprocessAllModules=true. In this repo, child modules hardcode the parent version (e.g., easy-rules-core/pom.xml), so only updating the root POM will leave module POMs pointing at the old parent version and break the reactor build/deploy.
| mvn -B -ntp versions:set -DnewVersion="${{ steps.version.outputs.VERSION }}" | |
| mvn -B -ntp versions:set -DprocessAllModules=true -DnewVersion="${{ steps.version.outputs.VERSION }}" |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sed -i "s#__CENTRAL_USERNAME__#${{ secrets.CENTRAL_USERNAME }}#g" "$HOME/.m2/settings.xml" | ||
| sed -i "s#__CENTRAL_PASSWORD__#${{ secrets.CENTRAL_PASSWORD }}#g" "$HOME/.m2/settings.xml" |
There was a problem hiding this comment.
This sed replacement approach is fragile: secrets containing characters like #, &, or newlines can break the substitution or produce invalid XML, causing deploy failures. Prefer Maven settings env interpolation (${env.CENTRAL_USERNAME}/${env.CENTRAL_PASSWORD}) or actions/setup-java's built-in server-id/server-username/server-password settings generation instead of in-place sed edits.
| with: | ||
| tag_name: ${{ github.ref_name }} | ||
| draft: false | ||
| prerelease: ${{ steps.reltype.outputs.TYPE == 'snapshot' || contains(github.ref, 'RC') || contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} |
There was a problem hiding this comment.
The prerelease logic includes RC/alpha/beta, but the earlier “Determine release type” step rejects any tag format other than vX.Y.Z or vX.Y.Z-SNAPSHOT (so those tags will never reach this step). Either expand the accepted tag formats (and keep README in sync) or remove the unreachable prerelease conditions.
| prerelease: ${{ steps.reltype.outputs.TYPE == 'snapshot' || contains(github.ref, 'RC') || contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
| prerelease: ${{ steps.reltype.outputs.TYPE == 'snapshot' }} |
No description provided.