Skip to content

Commit 19f0e1a

Browse files
committed
Publish releases on Maven Central without a manual step
The Maven Central deployer stopped after upload and validation, and each deployment waited in the Portal until someone pressed publish. JReleaser now publishes a deployment as soon as the Portal has validated it (stage FULL). That holds for the jars that `mise run release` and the release workflow deploy, and for the native images alike. skipPublicationCheck ends the deploy once publishing has started. Without it JReleaser waits for Maven Central to show the files, 20 s at a time up to 100 times, and a slow sync would fail the release job even though the publication goes on. A dry run resolves the deployer to stage FULL with the publication check skipped, and succeeds.
1 parent e2142e5 commit 19f0e1a

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ name: Release
44
# refuses anything that is not a clean X.Y.Z or X.Y.Z.N.
55
#
66
# Two deployments per tag, because a published groupId:artifactId:version can never gain files
7-
# afterwards: the jars go up as one, and every platform's native binary as another. Both are uploaded
8-
# and validated only — the Portal holds them until someone presses publish.
7+
# afterwards: the jars go up as one, and every platform's native binary as another. Each is published
8+
# as soon as the Portal has validated it, with no one pressing publish.
99
#
1010
# After both, a draft GitHub release on the tag collects the runnable jar, the IDE plugins and the native
1111
# binaries.
@@ -40,7 +40,7 @@ jobs:
4040
distribution: temurin
4141
java-version: '21'
4242

43-
- name: Stage, sign and upload the jars
43+
- name: Stage, sign and publish the jars
4444
run: ./gradlew jreleaserDeploy
4545
env:
4646
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
@@ -145,7 +145,7 @@ jobs:
145145
run: ls -l native-images
146146

147147
# No GraalVM here: nothing is compiled, the binaries are published exactly as they arrived.
148-
- name: Stage, sign and upload the native images
148+
- name: Stage, sign and publish the native images
149149
run: ./gradlew -PreleaseTarget=native -PnativeImages=native-images jreleaserDeploy
150150
env:
151151
JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_SONATYPE_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}

‎buildSrc/src/main/groovy/open-java-format.release-conventions.gradle‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jreleaser {
7979
skipTag = true
8080
tagName = '{{projectVersion}}'
8181
releaseName = '{{projectVersion}}'
82-
// Published by hand after a look, like the deployments waiting in the Portal.
82+
// Published by hand after a look.
8383
draft = true
8484
changelog {
8585
formatted = 'ALWAYS'
@@ -131,10 +131,11 @@ jreleaser {
131131
url = 'https://central.sonatype.com/api/v1/publisher'
132132
namespace = 'dev.openjavaformat'
133133
applyMavenCentralRules = true
134-
// Upload and validate, then stop. The deployment waits in the Portal until someone
135-
// presses publish, so a version stays reversible until every one of its deployments
136-
// is in and has been looked at.
137-
stage = 'UPLOAD'
134+
// Upload, wait for the Portal to validate the deployment, then publish it: nobody has
135+
// to press publish in the Portal. The deploy ends once publishing has started rather
136+
// than waiting, up to half an hour, for Maven Central to show the files.
137+
stage = 'FULL'
138+
skipPublicationCheck = true
138139
stagingRepositories.each { stagingRepository(it) }
139140
}
140141
}

‎mise.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ description = "Run the linux-aarch64 native job locally in Docker"
2121
run = "act push --job native --matrix platform:linux-aarch64"
2222

2323
# ---- Releases ----
24-
# JReleaser stages, signs and uploads to the Maven Central Portal the modules listed in
24+
# JReleaser stages, signs and publishes on the Maven Central Portal the modules listed in
2525
# buildSrc/src/main/groovy/open-java-format.release-conventions.gradle. The PGP key and the Portal
2626
# token come from JRELEASER_* variables or ~/.jreleaser/config.properties. Only a clean checkout of a
2727
# release tag is accepted. Run these through mise, not ./gradlew: JReleaser's POM check finds Java
@@ -32,7 +32,7 @@ run = "act push --job native --matrix platform:linux-aarch64"
3232
# published version can never gain files afterwards.
3333

3434
[tasks.release]
35-
description = "Stage, sign, and upload the release to the Maven Central Portal (publishing is a click there)"
35+
description = "Stage, sign, and publish the release on Maven Central"
3636
run = "./gradlew clean jreleaserDeploy"
3737

3838
[tasks."release:dry-run"]

0 commit comments

Comments
 (0)