Skip to content

Publish to Maven Central from GitHub Releases - #20

Open
williamfiset wants to merge 1 commit into
masterfrom
build/maven-central
Open

williamfiset wants to merge 1 commit into
masterfrom
build/maven-central

Conversation

@williamfiset

Copy link
Copy Markdown
Owner

Publishes io.github.williamfiset:fastjavaio to Maven Central whenever a GitHub Release is published.

Changes

  • build.gradle: adds the com.vanniktech.maven.publish plugin (0.37.0) for Central Portal publishing, with the full POM metadata Central requires. The license is listed as GPL-3.0, matching LICENSE. The plugin also builds the sources and javadoc jars, so withSourcesJar()/withJavadocJar() are removed. Releases are set to go live automatically once validation passes (publishToMavenCentral(true)).
  • Version: read from -PreleaseVersion, which the workflow sets from the release tag, with a leading v stripped. Local builds default to 1.3-SNAPSHOT.
  • Signing: runs only when a key is provided, so ./gradlew publishToMavenLocal works without GPG.
  • .github/workflows/release.yml: on release published, it runs the tests, publishes to Central, and attaches fastjavaio.jar to the release. You no longer need to build and upload the jar by hand.
  • .github/workflows/ci.yml: runs tests and javadoc on pushes to master and on PRs.

Verified

  • ./gradlew test publishToMavenLocal -PreleaseVersion=0.0.0-test produces the jar, sources, javadoc, POM and module files. The POM has no dependencies and the correct metadata.

One-time setup before the first release

  1. Sign in to https://central.sonatype.com with GitHub. The io.github.williamfiset namespace is verified automatically.
  2. Generate a user token (Account → Generate User Token).
  3. Create a GPG key and publish the public key to keys.openpgp.org.
  4. Add these repo secrets: MAVEN_CENTRAL_USERNAME, MAVEN_CENTRAL_PASSWORD (from the token), SIGNING_KEY (the ASCII-armored private key), and SIGNING_KEY_PASSWORD.

🤖 Generated with Claude Code

- Add the com.vanniktech.maven.publish plugin with POM metadata
  (GPL-3.0, SCM, developer) and Central Portal publishing.
- Version comes from -PreleaseVersion (the release tag); local builds
  are 1.3-SNAPSHOT. Signing only runs when a key is provided.
- release.yml publishes to Central and attaches fastjavaio.jar when a
  GitHub Release is published; ci.yml runs tests on pushes and PRs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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