Skip to content

HV-2096 Use JReleaser to publish hibernate artifacts #1606

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
6 changes: 0 additions & 6 deletions build/enforcer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@

<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
36 changes: 0 additions & 36 deletions build/reports/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,42 +118,6 @@
</dependency>
</dependencies>

<build>
<plugins>
<!--
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>
<profiles>
<profile>
<id>coverage-report</id>
Expand Down
3 changes: 0 additions & 3 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
<description>Builds the distribution bundles</description>

<properties>
<!-- Skip artifact deployment -->
<maven.deploy.skip>true</maven.deploy.skip>
<gpg.skip>true</gpg.skip>
<!--
Any javadoc warnings should've been caught already while the previous modules were built.
Also see additional explanations on this property in the `hibernate-search-mapper-orm-jakarta-batch-core` module.
Expand Down
3 changes: 0 additions & 3 deletions documentation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
<html.meta.project-key>validator</html.meta.project-key>
<html.outdated-content.project-key>${html.meta.project-key}</html.outdated-content.project-key>

<!-- Skip artifact deployment -->
<maven.deploy.skip>true</maven.deploy.skip>
<gpg.skip>true</gpg.skip>
<surefire.jvm.args.additional>-Duser.language=en -Duser.country=US</surefire.jvm.args.additional>

<forbiddenapis-junit.path>forbidden-allow-junit.txt</forbiddenapis-junit.path>
Expand Down
16 changes: 12 additions & 4 deletions jenkins/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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 @@ -68,13 +69,20 @@ 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: 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' : ''} \
validator ${releaseVersion.toString()} ${developmentVersion.toString()}
"""
}
Expand Down
17 changes: 10 additions & 7 deletions jenkins/snapshot-publish/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ pipeline {
stage('Publish') {
steps {
script {
withMaven(mavenSettingsConfig: 'ci-hibernate.deploy.settings.maven',
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
sh """mvn \
-Pci-build \
-DskipTests \
clean deploy \
"""
withMaven(mavenSettingsConfig: 'ci-hibernate.deploy.settings.maven', mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
dir('.release/scripts') {
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git .'
}
def version = sh(
script: ".release/scripts/determine-current-version.sh validator",
returnStdout: true
).trim()
echo "Current version: '${version}'"
sh "bash -xe .release/scripts/snapshot-deploy.sh validator ${version}"
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions parents/public/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
75 changes: 7 additions & 68 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
<!-- Note: when updating this version, consider reviewing the list of JDKs the forbidden API plugin is targeting. -->
<version.forbiddenapis.plugin>3.9</version.forbiddenapis.plugin>
<version.gmavenplus.plugin>4.2.0</version.gmavenplus.plugin>
<version.gpg.plugin>3.2.7</version.gpg.plugin>
<version.install.plugin>3.1.4</version.install.plugin>
<version.japicmp.plugin>0.23.1</version.japicmp.plugin>
<version.jar.plugin>3.4.2</version.jar.plugin>
Expand All @@ -260,7 +259,6 @@
<version.surefire.plugin>3.5.3</version.surefire.plugin>
<version.surefire.plugin.java-version.asm>9.8</version.surefire.plugin.java-version.asm>
<version.failsafe.plugin>${version.surefire.plugin}</version.failsafe.plugin>
<version.nexus-staging-maven-plugin>1.7.0</version.nexus-staging-maven-plugin>
<version.flatten-maven-plugin>1.7.0</version.flatten-maven-plugin>
<version.moditect.plugin>1.2.2.Final</version.moditect.plugin>
<version.sisu-maven-plugin>0.9.0.M3</version.sisu-maven-plugin>
Expand All @@ -276,9 +274,9 @@

<!-- Repository Deployment URLs -->

<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>
<!-- 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.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 @@ -745,36 +743,6 @@
</execution>
</executions>
</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>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -1199,13 +1167,9 @@
<version>${version.deploy.plugin}</version>
<configuration>
<!-- we use the nexus-staging plugin -->
<skip>${maven-deploy-plugin.skip}</skip>
<skip>${deploy.skip}</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>${version.gpg.plugin}</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.resources.plugin}</version>
Expand Down Expand Up @@ -1563,14 +1527,6 @@
<artifactId>versions-maven-plugin</artifactId>
<version>${version.versions.plugin}</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${version.nexus-staging-maven-plugin}</version>
<configuration>
<skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-wrapper-plugin</artifactId>
Expand Down Expand Up @@ -1639,9 +1595,9 @@

<distributionManagement>
<repository>
<id>${ossrh.releases.repo.id}</id>
<name>OSSRH Releases Repository</name>
<url>${ossrh.releases.repo.url}</url>
<id>${local.staging.releases.repo.id}</id>
<name>Local Staging Directory Releases Repository</name>
<url>${local.staging.releases.repo.url}</url>
</repository>
<snapshotRepository>
<id>${ossrh.snapshots.repo.id}</id>
Expand Down Expand Up @@ -1700,23 +1656,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
<bestPractices>true</bestPractices>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down