chore: migrate CI to unified publish.yml with Sonatype Central Portal#46
Conversation
- Delete maven.yml, snapshot.yml, maven-publish.yml - Add publish.yml: build → test → publish-snapshot OR publish-release → post-publish - Snapshot deploys to Central Portal on main push or manual dispatch - Release deploys to Central Portal with GPG signing on v* tags - Post-publish: dependency graph, Codecov, Coveralls - Add codeql.yml for GitHub Advanced Security scanning (weekly + PR) https://claude.ai/code/session_01TPLSUAgEHPFGSoDesiPZ5N
…ava@v5, upload-artifact@v7, download-artifact@v8, codecov-action@v6) https://claude.ai/code/session_01TPLSUAgEHPFGSoDesiPZ5N
- Replace GitHub Packages distributionManagement with Central Portal snapshotRepository (https://central.sonatype.com/repository/maven-snapshots/) - Replace github-java-llama GitHub Packages repository with Central Portal snapshots so the llama:5.0.0-SNAPSHOT dependency resolves from Central Portal https://claude.ai/code/session_01TPLSUAgEHPFGSoDesiPZ5N
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-java@v5 | ||
| with: { java-version: '8', distribution: temurin } |
There was a problem hiding this comment.
The project's CLAUDE.md declares Java 21 as the requirement, but this is using Java 8. To match the project specification and ensure CodeQL analyzes code as it will be compiled, this should use Java 21:
| with: { java-version: '8', distribution: temurin } | |
| with: { java-version: '21', distribution: temurin } |
Also update the pom.xml compiler properties to match.
There was a problem hiding this comment.
The project compiles Java 8 bytecode (maven.compiler.source=1.8, maven.compiler.target=1.8) and the publish.yml uses JDK 8. The CodeQL workflow uses the same version for consistency — CodeQL should analyze the code under the same JDK used to build it.
The CLAUDE.md mentions Java 21 as the runtime requirement, but the bytecode target is 1.8 and JDK 8 is the correct compiler to use here. Using Java 21 in CodeQL would also work (JDK 21 can compile 1.8 targets), but it would introduce a mismatch with the build configuration without any benefit.
Generated by Claude Code
| <snapshotRepository> | ||
| <id>central</id> | ||
| <url>https://central.sonatype.com/repository/maven-snapshots/</url> | ||
| </snapshotRepository> |
There was a problem hiding this comment.
The pom.xml defines only <snapshotRepository> but should also define <releaseRepository> for release deployments to a distinct production repository URL. Add after the snapshotRepository:
<releaseRepository>
<id>central</id>
<url>https://central.sonatype.com/</url>
</releaseRepository>This follows Maven best practices for multi-environment deployments.
There was a problem hiding this comment.
This is not needed. central-publishing-maven-plugin with <extensions>true</extensions> (in the release profile) intercepts the deploy lifecycle for non-SNAPSHOT versions and uploads directly to Central Portal via its API. It does not use distributionManagement/<repository> or <releaseRepository>. Only <publishingServerId> matters for the plugin configuration.
Generated by Claude Code
|
|
- github/codeql-action bumped from v3 to v4 (latest major) - Add permissions: contents: read at workflow level - post-publish job gets permissions: contents: write (needed by maven-dependency-submission-action to submit the dependency graph) https://claude.ai/code/session_01TPLSUAgEHPFGSoDesiPZ5N
Review SummaryThis PR successfully consolidates the CI/CD pipeline to a unified ✅ Strengths
|
| <distributionManagement> | ||
| <repository> | ||
| <id>github</id> | ||
| <name>GitHub Packages</name> | ||
| <url>https://maven.pkg.github.com/bernardladenthin/llamacpp-ai-index-maven-plugin</url> | ||
| </repository> | ||
| <snapshotRepository> | ||
| <id>central</id> | ||
| <url>https://central.sonatype.com/repository/maven-snapshots/</url> | ||
| </snapshotRepository> | ||
| </distributionManagement> |
There was a problem hiding this comment.
Consider adding a <repository> element for releases alongside the snapshotRepository. While central-publishing-maven-plugin handles the deployment, explicitly declaring both provides clarity and follows Maven best practices:
| <distributionManagement> | |
| <repository> | |
| <id>github</id> | |
| <name>GitHub Packages</name> | |
| <url>https://maven.pkg.github.com/bernardladenthin/llamacpp-ai-index-maven-plugin</url> | |
| </repository> | |
| <snapshotRepository> | |
| <id>central</id> | |
| <url>https://central.sonatype.com/repository/maven-snapshots/</url> | |
| </snapshotRepository> | |
| </distributionManagement> | |
| <distributionManagement> | |
| <snapshotRepository> | |
| <id>central</id> | |
| <url>https://central.sonatype.com/repository/maven-snapshots/</url> | |
| </snapshotRepository> | |
| <repository> | |
| <id>central</id> | |
| <url>https://central.sonatype.com/repository/maven-releases/</url> | |
| </repository> | |
| </distributionManagement> |
There was a problem hiding this comment.
Not needed — see the other comment. central-publishing-maven-plugin with extensions: true replaces the standard Maven deploy plugin for release versions, so distributionManagement/<repository> is never consulted during mvn deploy -P release. Adding it would only add confusion since it would never be used.
Generated by Claude Code
Summary
maven.yml,snapshot.yml,maven-publish.yml— replaced by the unified pipelinepublish.yml: single workflow covering build → test → publish-snapshot OR publish-release → post-publishpublish-snapshot: deploys to Sonatype Central Portal snapshot repo on every push tomainor manual dispatch; usesenvironment: maven-centralpublish-release: deploys signed release to Central Portal onv*tags; usesenvironment: maven-centralpost-publish: dependency graph, Codecov, Coverallscodeql.yml: GitHub Advanced Security scanning on PRs, pushes tomain, and weekly schedulepom.xml:distributionManagementwith Central PortalsnapshotRepositorygithub-java-llamaGitHub Packages repository with Central Portal snapshots so thellama:5.0.0-SNAPSHOTdependency resolves correctly after java-llama.cpp publishes snapshots therePrerequisites (must be done in GitHub UI before workflows run)
maven-centralmainas an allowed branchmaven-centralenvironment:CENTRAL_USERNAME,CENTRAL_TOKEN,GPG_PRIVATE_KEY,GPG_PASSPHRASECODECOV_TOKEN,COVERALLS_TOKENllama:5.0.0-SNAPSHOT)Test plan
main→ build + test + publish-snapshot + post-publishv*tag → build + test + publish-release (pauses at environment approval) + post-publishhttps://claude.ai/code/session_01TPLSUAgEHPFGSoDesiPZ5N
Generated by Claude Code