Skip to content

ci: publish to Maven Central when a version tag is pushed - #129

Merged
rocketraman merged 2 commits into
masterfrom
rg/release-workflow
Dec 5, 2026
Merged

rocketraman merged 2 commits into
masterfrom
rg/release-workflow

Conversation

@rocketraman

@rocketraman rocketraman commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Pushing a vX.Y.Z tag now publishes that release to Maven Central from GitHub Actions. Until now, releases were published only from a maintainer's machine.

The new Release workflow (.github/workflows/release.yml):

  • runs on a pushed vX.Y.Z tag, in the release environment, which needs a maintainer's approval before the job starts
  • checks that the build's version, which comes from the tag on HEAD, is the tag's version, so it can never publish a -SNAPSHOT
  • imports the CI signing subkey (SIGNING_KEY) into gpg and runs ./gradlew publishToMavenCentral
  • names the subkey with a trailing !, so gpg signs with the subkey rather than the export's stub primary
  • reads the Central Portal token from the MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD environment secrets

docs/releasing.adoc describes the tag-push flow and its secrets. It keeps publishing from a maintainer's machine as a fallback. The header comment in ci.yml now points to the release workflow. The expiry section also now says an expired signing key can still be extended, and what breaks until it is.

Repository settings this relies on

These are already applied:

  • the release environment admits only v* tags, and keeps its required reviewer
  • the Release tags ruleset blocks creating, moving, or deleting v* tags for everyone but repository admins, including GITHUB_TOKEN

Before the first release, MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD must be added to the release environment.

Testing

  • Signing: a throwaway key's subkey was exported with --export-secret-subkeys '<fpr>!' and imported into an empty keyring, matching the CI export. :boot-common:signMavenPublication was then run with signing.gnupg.keyName=<fpr>! and the passphrase, with no TTY. The signatures verify, made by the subkey.
  • The version check prints 3.1.0 on the v3.1.0 commit and 3.1.0-SNAPSHOT on the commit before it.
  • actionlint (with shellcheck) passes.
  • The workflow itself has not run yet; the first tag push is its first run.

Add a Release workflow, run on a pushed vX.Y.Z tag in the release
environment. It checks the build's version is the tag's, imports the
CI signing subkey into gpg, and runs publishToMavenCentral.

- The subkey is named with a trailing ! so gpg signs with it, not
  with the export's stub primary.
- The Central Portal token comes from the MAVEN_CENTRAL_USERNAME and
  MAVEN_CENTRAL_PASSWORD environment secrets.

docs/releasing.adoc describes the tag-push flow, its secrets, and
publishing from a maintainer's machine as a fallback.
@claude

claude Bot commented Dec 5, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Expiry isn't revocation: the card can extend the primary and its
subkeys after they expire. The doc now says so, and what breaks while
the key is expired, rather than implying expiry is final.
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.2
Preview removed because the pull request was closed.
2026-12-05 07:58 UTC

@rocketraman
rocketraman merged commit 0a6417d into master Dec 5, 2026
3 of 4 checks passed
@rocketraman
rocketraman deleted the rg/release-workflow branch December 5, 2026 07:58
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