Skip to content

HBX-3011 Switch to Maven Central publishing 6.4 #5215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 6.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ pipeline {
defaultValue: true,
description: 'If true, just simulate the release, without pushing any commits or tags, and without uploading any artifacts or documentation.'
)
booleanParam(
name: 'RELEASE_PUBLISH_AUTOMATICALLY',
defaultValue: true,
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.'
)
}
stages {
stage('Release') {
Expand All @@ -75,6 +80,9 @@ pipeline {
def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
env.JRELEASER_DRY_RUN = params.RELEASE_DRY_RUN
if (!params.RELEASE_PUBLISH_AUTOMATICALLY) {
env.JRELEASER_DEPLOY_MAVEN_MAVENCENTRAL_STAGE='UPLOAD'
}
echo "Performing full release for version ${releaseVersion.toString()}"

withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
Expand All @@ -84,11 +92,7 @@ pipeline {
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
// TODO: Once we switch to maven-central publishing (from nexus2) we need to add a new credentials
// to use the following env variable names to set the user/password:
// JRELEASER_MAVENCENTRAL_USERNAME
// JRELEASER_MAVENCENTRAL_TOKEN
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'JRELEASER_NEXUS2_PASSWORD', usernameVariable: 'JRELEASER_NEXUS2_USERNAME'),
usernamePassword(credentialsId: 'central.sonatype.com', passwordVariable: 'JRELEASER_MAVENCENTRAL_TOKEN', usernameVariable: 'JRELEASER_MAVENCENTRAL_USERNAME'),
string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN')]) {
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
sh 'cat $HOME/.ssh/config'
Expand Down
60 changes: 44 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<artifactId>jboss-parent</artifactId>
<version>49</version>
</parent>

<groupId>org.hibernate.tool</groupId>
<artifactId>hibernate-tools-parent</artifactId>
<version>6.4.11-SNAPSHOT</version>

<packaging>pom</packaging>

<name>Hibernate Tools Parent Project</name>

<url>http://hibernate.org/tools/</url>
Expand Down Expand Up @@ -117,16 +117,20 @@
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
<local.staging.releases.repo.name>Local Staging Directory Releases Repository</local.staging.releases.repo.name>
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
<ossrh.snapshots.repo.name>Sonatype OSSRH Snapshots</ossrh.snapshots.repo.name>
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
<central.releases.repo.id>central-releases</central.releases.repo.id>
<central.releases.repo.name>Maven Central Releases Repository</central.releases.repo.name>
<central.releases.repo.url>https://central.sonatype.com/api/v1/publisher/</central.releases.repo.url>
<central.snapshots.repo.id>central-snapshots</central.snapshots.repo.id>
<central.snapshots.repo.name>Maven Central Snapshots Repository</central.snapshots.repo.name>
<central.snapshots.repo.url>https://central.sonatype.com/repository/maven-snapshots/</central.snapshots.repo.url>


<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.min.version>3.9.7</maven.min.version>

</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -245,16 +249,16 @@
</dependencyManagement>

<distributionManagement>
<repository>
<id>${local.staging.releases.repo.id}</id>
<name>${local.staging.releases.repo.name}</name>
<url>${local.staging.releases.repo.url}</url>
</repository>
<snapshotRepository>
<id>${ossrh.snapshots.repo.id}</id>
<name>${ossrh.snapshots.repo.name}</name>
<url>${ossrh.snapshots.repo.url}</url>
</snapshotRepository>
<repository>
<id>${central.releases.repo.id}</id>
<name>${central.releases.repo.name}</name>
<url>${central.releases.repo.url}</url>
</repository>
<snapshotRepository>
<id>${central.snapshots.repo.id}</id>
<name>${central.snapshots.repo.name}</name>
<url>${central.snapshots.repo.url}</url>
</snapshotRepository>
</distributionManagement>

<build>
Expand Down Expand Up @@ -332,4 +336,28 @@
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<altReleaseDeploymentRepository>${local.staging.releases.repo.id}::${local.staging.releases.repo.url}</altReleaseDeploymentRepository>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>