Skip to content

Conversation

@nightscape
Copy link
Contributor

@nightscape nightscape commented Feb 6, 2026

Following up on your How To Publish to Maven Central Easily with Mill blog post, I'd like to propose a few additional automations:

  • initGpgKeys now auto-detects developer name, email, and URL from pomSettings and pre-fills the prompts, so users can just press Enter to accept defaults
  • After key generation, the command offers to write credentials directly into detected shell config files (bash, zsh, fish, nushell, powershell) with a diff preview before applying
  • If gh CLI is authenticated, offers to upload secrets directly to the GitHub repository
  • Prompts for Sonatype credentials during the same flow instead of requiring users to set them separately
  • Users can type "q" at any prompt to abort cleanly
  • Keyserver URL is now configurable via --keyserverUrl parameter, allowing tests to use a mock server instead of hitting the real keyserver

Technical details

  • New ShellConfiguration utility in libs/util/java11 handles cross-platform shell config detection and atomic env var upsert with proper escaping per shell
  • Integration test uses an in-process HTTP mock keyserver instead of relying on keyserver.ubuntu.com
  • Keyserver verification uses a bounded retry count (3 attempts) instead of a 60-second deadline loop

Usage of AI

  1. Claude Opus 4.6 created the initial plan.
  2. I did multiple rounds of manual plan reviews and refinements.
  3. Claude generated the implementation.
  4. I did multiple rounds of manual and automated code reviews until I was happy with the result.

@nightscape nightscape force-pushed the more-sonatype-automation branch 9 times, most recently from 28c1095 to 2902448 Compare February 9, 2026 13:17
@nightscape nightscape marked this pull request as ready for review February 9, 2026 13:17
Copilot AI review requested due to automatic review settings February 9, 2026 13:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Mill’s Sonatype Central publishing setup by enhancing the interactive initGpgKeys flow and adding cross-shell helpers to preview/apply environment-variable configuration automatically.

Changes:

  • Add ShellConfiguration utilities to detect shell config files, format env-var lines, and upsert them (with optional diff preview).
  • Enhance initGpgKeys to pass POM-derived hints (name/email/url), support configurable keyserver URL, and offer guided local shell + GitHub Actions setup.
  • Add unit/integration tests for shell env-var formatting/upsert behavior and the updated initGpgKeys flow (with a mock keyserver).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
libs/util/java11/src/mill/util/ShellConfiguration.scala New shell detection + env-var formatting/matching + upsert/preview helpers
libs/util/test/src/mill/util/ShellConfigurationTests.scala Unit tests for escaping, regex matching, and upsert behavior
libs/javalib/src/mill/javalib/SonatypeCentralPublishModule.scala Extend initGpgKeys command to pass keyserver URL + POM-derived hints
libs/javalib/pgp-worker/src/mill/javalib/pgp/worker/MillInitGpgKeysMain.scala Expanded interactive workflow (upload/verify, local shell setup, optional gh secret upload)
integration/feature/init-gpg-publish/src/InitGpgPublishTests.scala Integration test updated to use a local mock keyserver + new output expectations
libs/javalib/package.mill MiMa exclusion for signature change + add util dependency for pgp-worker

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nightscape nightscape force-pushed the more-sonatype-automation branch from 2902448 to de9b0cc Compare February 9, 2026 17:44
@nightscape
Copy link
Contributor Author

@lihaoyi @lefou this is good to review from my side.

@nightscape nightscape force-pushed the more-sonatype-automation branch from de9b0cc to 051fd0a Compare February 11, 2026 16:40
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