Skip to content

ci: publish to Maven Central from version tags - #2

Merged
drkjc merged 3 commits into
mainfrom
publish-workflow
Nov 5, 2026
Merged

drkjc merged 3 commits into
mainfrom
publish-workflow

Conversation

@drkjc

@drkjc drkjc commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • publish.yml: on a v* tag, checks the tag matches the pom.xml version and SDK_VERSION in Constants.java, the commit is on main, and CHANGELOG.md has a released section for the version
  • Build job (contents: read): runs the tests on Java 11 and 25, packages the jar, sources jar, javadoc jar and POM, writes a CycloneDX SBOM, audits runtime dependencies with OSV-Scanner, writes SHA-256 checksums and scans the package with gitleaks
  • Publish job (release environment): verifies the checksums, fails if the version is already on Maven Central, signs with gpg, checks the signatures against the key on keyserver.ubuntu.com, and uploads with the Central Publisher API; no Maven or plugin code runs in this job
  • Release job: creates the GitHub Release with the CHANGELOG notes, the jars, the POM, SHA256SUMS and the SBOM
  • pom.xml: fixed build timestamps so release jars are reproducible; removes maven-gpg-plugin and central-publishing-maven-plugin, which the workflow replaces
  • README: mvn clean install no longer needs -Dgpg.skip

drkjc added 3 commits November 4, 2026 17:51
Sets project.build.outputTimestamp and javadoc's notimestamp, so building the same commit twice produces identical jars.
The publish workflow signs and uploads releases, so mvn install no longer needs -Dgpg.skip.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 22:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Release safety depends on external reviewer requirements, v* tag restrictions, and signing-key/Central credential configuration that a maintainer must verify outside the repository snapshot.

No open issues 🎉

What changed in this PR

Moves Maven Central publishing from Maven plugins to a version-tag-triggered GitHub Actions workflow, separating build and dependency execution from release credentials.

Changes:

  • Validates release metadata, tests on Java 11 and 25, and prepares artifacts with dependency and secret scans.
  • Adds gated signing, checksum verification, Maven Central publishing, and GitHub Release creation.
  • Configures reproducible build timestamps and simplifies local build instructions.
File Description
README.md Removes the signing-skip flag from local build instructions.
pom.xml Adds reproducibility settings and removes signing and publishing plugins.
.github/​workflows/​publish.yml Adds tag-driven validation, testing, scanning, signing, publishing, and release creation.

Review effort: Balanced

@Samy-O7 Samy-O7 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked before approving by running the workflow's build steps locally (Temurin 25.0.5 and 11.0.32.1, Maven 3.9.15) and the publish job's Sign, verify and Bundle steps with a throwaway key:

  • The check step passes for a v1.0.0 tag once CHANGELOG.md has a dated ## 1.0.0 heading (com.spreedly:composer-sdk-server, 39-line notes). It fails for a wrong tag, the current (unreleased) heading, a commit that isn't on main and a mismatched SDK_VERSION.
  • Tests pass on Java 11 and 25, and the package step builds the jar (Java 11 bytecode, with LICENSE, NOTICE and THIRD-PARTY-LICENSES), the sources and javadoc jars and the POM. A second build from another directory produced byte-identical files.
  • The SBOM is valid CycloneDX 1.6 with the 11 runtime dependencies. OSV-Scanner 2.7.0 reads all 11 and reports nothing, and it fails with GHSA-4jrv-ppp4-jm57 when gson is swapped for 2.8.8. gitleaks finds nothing in the unzipped jars and POM. Both pinned downloads match the official checksums.
  • With a key that also has a signing subkey, the Sign step signs all four files with the primary key, the verify step accepts them, and the bundle has the repository layout with .asc, .md5 and .sha1 files. A lowercase fingerprint, a wrong passphrase and a jar changed after signing each stop the job.
  • Only the publish job's Sign and Publish steps read the signing key and the token, and no Maven code runs in that job. The encoded token is masked and sent from a header file.

@drkjc
drkjc merged commit 9acf1f9 into main Nov 5, 2026
6 checks passed
@drkjc
drkjc deleted the publish-workflow branch November 5, 2026 21:46
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.

3 participants