Skip to content

Commit 60d1239

Browse files
committed
HBX-3011 Switch to Maven Central publishing
1 parent da0fec9 commit 60d1239

File tree

2 files changed

+53
-21
lines changed

2 files changed

+53
-21
lines changed

ci/release/Jenkinsfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ pipeline {
5151
defaultValue: true,
5252
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts or documentation.'
5353
)
54+
booleanParam(
55+
name: 'RELEASE_PUBLISH_AUTOMATICALLY',
56+
defaultValue: true,
57+
description: 'If true, staging repository will get closed and published automatically, otherwise the artifacts will only be uploaded and the publishing (releasing the staging repository) has to be performed manually at Maven Central portal.'
58+
)
5459
}
5560
stages {
5661
stage('Release') {
@@ -75,6 +80,9 @@ pipeline {
7580
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
7681
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
7782
env.JRELEASER_DRY_RUN = params.RELEASE_DRY_RUN
83+
if (!params.RELEASE_PUBLISH_AUTOMATICALLY) {
84+
env.JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_STAGE='UPLOAD'
85+
}
7886
echo "Performing full release for version ${releaseVersion.toString()}"
7987

8088
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
@@ -84,11 +92,7 @@ pipeline {
8492
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
8593
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
8694
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
87-
// TODO: Once we switch to maven-central publishing (from nexus2) we need to add a new credentials
88-
// to use the following env variable names to set the user/password:
89-
// JRELEASER_MAVENCENTRAL_USERNAME
90-
// JRELEASER_MAVENCENTRAL_TOKEN
91-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'JRELEASER_NEXUS2_PASSWORD', usernameVariable: 'JRELEASER_NEXUS2_USERNAME'),
95+
usernamePassword(credentialsId: 'central.sonatype.com', passwordVariable: 'JRELEASER_MAVENCENTRAL_TOKEN', usernameVariable: 'JRELEASER_MAVENCENTRAL_USERNAME'),
9296
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
9397
string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN')]) {
9498
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {

pom.xml

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<artifactId>jboss-parent</artifactId>
2626
<version>49</version>
2727
</parent>
28-
28+
2929
<groupId>org.hibernate.tool</groupId>
3030
<artifactId>hibernate-tools-parent</artifactId>
3131
<version>6.5.4-SNAPSHOT</version>
3232

3333
<packaging>pom</packaging>
34-
34+
3535
<name>Hibernate Tools Parent Project</name>
3636

3737
<url>http://hibernate.org/tools/</url>
@@ -118,16 +118,20 @@
118118
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
119119
<local.staging.releases.repo.name>Local Staging Directory Releases Repository</local.staging.releases.repo.name>
120120
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
121-
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
122-
<ossrh.snapshots.repo.name>Sonatype OSSRH Snapshots</ossrh.snapshots.repo.name>
123-
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
121+
<central.releases.repo.id>central-releases</central.releases.repo.id>
122+
<central.releases.repo.name>Maven Central Releases Repository</central.releases.repo.name>
123+
<central.releases.repo.url>https://central.sonatype.com/api/v1/publisher/</central.releases.repo.url>
124+
<central.snapshots.repo.id>central-snapshots</central.snapshots.repo.id>
125+
<central.snapshots.repo.name>Maven Central Snapshots Repository</central.snapshots.repo.name>
126+
<central.snapshots.repo.url>https://central.sonatype.com/repository/maven-snapshots/</central.snapshots.repo.url>
127+
124128

125129
<maven.compiler.target>11</maven.compiler.target>
126130
<maven.compiler.source>11</maven.compiler.source>
127131
<maven.min.version>3.9.7</maven.min.version>
128132

129133
</properties>
130-
134+
131135
<dependencyManagement>
132136
<dependencies>
133137
<dependency>
@@ -246,16 +250,16 @@
246250
</dependencyManagement>
247251

248252
<distributionManagement>
249-
<repository>
250-
<id>${local.staging.releases.repo.id}</id>
251-
<name>${local.staging.releases.repo.name}</name>
252-
<url>${local.staging.releases.repo.url}</url>
253-
</repository>
254-
<snapshotRepository>
255-
<id>${ossrh.snapshots.repo.id}</id>
256-
<name>${ossrh.snapshots.repo.name}</name>
257-
<url>${ossrh.snapshots.repo.url}</url>
258-
</snapshotRepository>
253+
<repository>
254+
<id>${central.releases.repo.id}</id>
255+
<name>${central.releases.repo.name}</name>
256+
<url>${central.releases.repo.url}</url>
257+
</repository>
258+
<snapshotRepository>
259+
<id>${central.snapshots.repo.id}</id>
260+
<name>${central.snapshots.repo.name}</name>
261+
<url>${central.snapshots.repo.url}</url>
262+
</snapshotRepository>
259263
</distributionManagement>
260264

261265
<build>
@@ -333,4 +337,28 @@
333337
</plugins>
334338
</build>
335339

340+
<profiles>
341+
<profile>
342+
<id>release</id>
343+
<activation>
344+
<property>
345+
<name>performRelease</name>
346+
<value>true</value>
347+
</property>
348+
</activation>
349+
<build>
350+
<pluginManagement>
351+
<plugins>
352+
<plugin>
353+
<groupId>org.apache.maven.plugins</groupId>
354+
<artifactId>maven-deploy-plugin</artifactId>
355+
<configuration>
356+
<altReleaseDeploymentRepository>${local.staging.releases.repo.id}::${local.staging.releases.repo.url}</altReleaseDeploymentRepository>
357+
</configuration>
358+
</plugin>
359+
</plugins>
360+
</pluginManagement>
361+
</build>
362+
</profile>
363+
</profiles>
336364
</project>

0 commit comments

Comments
 (0)