Skip to content

Backport of HSEARCH-5351 to 7.0 : Switch to JReleaser for nexus publishing #4613

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: 7.0
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
3 changes: 3 additions & 0 deletions .release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The folder into which we checkout our release scripts into
*
!.gitignore
32 changes: 0 additions & 32 deletions build/reports/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,38 +186,6 @@
</dependency>
</dependencies>
</plugin>
<!--
Hack to deploy in the "reports" module without deploying the "reports" module itself.
The default lifecycle bindings of the plugin is to "stage locally" every artifact throughout
the maven execution, and only actually deploy the "locally staged" artifacts
in the very last executed module, which happens to be this "reports" module.
However, this "reports" module does not generate any artifact we want to deploy.
Thus, we'd like to prevent even its POM from being deployed: just deploy the "locally staged" artifacts,
without adding the POM from the "reports" module to these artifacts.
The default lifecycle bindings of the plugin does not offer a configuration option to do that,
so we have to explicitly bind it
-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>false</extensions>
<!-- The <configuration> element is inherited from the parent module. -->
<executions>
<!-- Skip the default deployment, as explained above we don't want it. -->
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
<!-- ... but execute the deferred deployment for the other modules -->
<execution>
<id>deferred-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy-staged</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
17 changes: 13 additions & 4 deletions ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pipeline {

def releaseVersion = Version.parseReleaseVersion(params.RELEASE_VERSION)
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
env.JRELEASER_DRY_RUN = params.RELEASE_DRY_RUN
echo "Performing full release for version ${releaseVersion.toString()}"

withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
Expand All @@ -70,13 +71,21 @@ pipeline {
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
// 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: 'MAVEN_GPG_PASSPHRASE')]) {
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
// TODO: HSEARCH-5354
// 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'),
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'
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git'
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg'
dir('.release/scripts') {
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git .'
}
sh """
bash -xe hibernate-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \
bash -xe .release/scripts/release.sh -j ${params.RELEASE_DRY_RUN ? '-d' : ''} \
search ${releaseVersion.toString()} ${developmentVersion.toString()}
"""
}
Expand Down
5 changes: 2 additions & 3 deletions distribution/src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,8 @@
<exclude>copyright.txt</exclude>
<exclude>lgpl.txt</exclude>

<!-- only needed for documentation and helper scripts, no need to include them -->
<exclude>hibernate-noorm-release-scripts/**</exclude>
<exclude>hibernate-release-scripts/**</exclude>
<!-- only needed for documentation and helper scripts, no need to include them -->
<exclude>.release/**</exclude>

<!-- actual files which should be ignored -->
<exclude>.git</exclude>
Expand Down
92 changes: 16 additions & 76 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@
<version.enforcer.plugin>3.4.0</version.enforcer.plugin>
<version.project-info.plugin>3.5.0</version.project-info.plugin>
<version.japicmp.plugin>0.18.3</version.japicmp.plugin>
<version.nexus-staging.plugin>1.6.13</version.nexus-staging.plugin>
<version.deploy.plugin>3.1.1</version.deploy.plugin>
<version.gpg.plugin>3.1.0</version.gpg.plugin>
<version.flatten-maven-plugin>1.5.0</version.flatten-maven-plugin>
<version.assembly.plugin>3.6.0</version.assembly.plugin>
<version.buildhelper.plugin>3.5.0</version.buildhelper.plugin>
Expand Down Expand Up @@ -308,9 +306,11 @@

<!-- Repository Deployment URLs -->

<!-- We always publish to a local directory, JReleaser is supposed to take care of publishing to Nexus: -->
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
<ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
<ossrh.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</ossrh.releases.repo.url>
<ossrh.releases.repo.baseUrl>https://oss.sonatype.org/</ossrh.releases.repo.baseUrl>
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>

Expand Down Expand Up @@ -539,39 +539,13 @@
</executions>
</plugin>
<!-- We want to deploy the public BOM, so we manage this plugin in the root pom. -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${version.nexus-staging.plugin}</version>
<configuration>
<skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
<!-- We want to disable this plugin as soon as possible, hence we manage it in the root pom. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${version.deploy.plugin}</version>
</plugin>
<!-- Public BOM must be also signed, so we manage this plugin in the root pom. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${version.gpg.plugin}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<skip>${deploy.skip}</skip>
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
<bestPractices>true</bestPractices>
</configuration>
</execution>
</executions>
<configuration>
<skip>${deploy.skip}</skip>
</configuration>
</plugin>
<!-- Public BOM will be flattened too, so we manage this plugin in the root pom. -->
<plugin>
Expand Down Expand Up @@ -1051,44 +1025,6 @@
</plugins>
</pluginManagement>
<plugins>
<!-- Skip the deploy plugin explicitly: we use nexus-staging-maven-plugin instead -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!--
Configure the nexus-staging-maven-plugin explicitly (without <extension>true</extension>)
in order to work around a problem in the "reports" module (see that module's POM for more info).
-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>false</extensions><!-- This is essential: do not put true here -->
<configuration>
<serverId>${ossrh.releases.repo.id}</serverId>
<!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
<nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
<!-- oss.sonatype.org has been very slow when closing repositories lately;
let's raise the timeout until we switch to s01.sonatype.org -->
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
</configuration>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<!--
This will only put artifacts in a staging directory.
See the "reports" module for actual deployment, at the end of the build.
-->
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -1380,12 +1316,16 @@
<javadoc.generate.jar.phase>prepare-package</javadoc.generate.jar.phase>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<altReleaseDeploymentRepository>${local.staging.releases.repo.id}::${local.staging.releases.repo.url}</altReleaseDeploymentRepository>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

Expand Down