From 6e6ed95a39aa4f4e7f0e802d219b31defcf52716 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Thu, 10 Apr 2025 12:29:13 +0200 Subject: [PATCH] HSEARCH-5351 Switch to JReleaser for nexus publishing --- .release/.gitignore | 3 + build/reports/pom.xml | 32 ------- ci/release/Jenkinsfile | 16 +++- ci/snapshot-publish/Jenkinsfile | 25 ++++-- distribution/src/main/assembly/dist.xml | 1 + jreleaser.yml | 58 +++++++++++++ pom.xml | 106 ++---------------------- 7 files changed, 97 insertions(+), 144 deletions(-) create mode 100644 .release/.gitignore create mode 100644 jreleaser.yml diff --git a/.release/.gitignore b/.release/.gitignore new file mode 100644 index 00000000000..cdd9a17d6b0 --- /dev/null +++ b/.release/.gitignore @@ -0,0 +1,3 @@ +# The folder into which we checkout our release scripts into +* +!.gitignore \ No newline at end of file diff --git a/build/reports/pom.xml b/build/reports/pom.xml index 7a98e9bd637..aa9c2b13b27 100644 --- a/build/reports/pom.xml +++ b/build/reports/pom.xml @@ -214,38 +214,6 @@ - - - org.sonatype.plugins - nexus-staging-maven-plugin - false - - - - - default-deploy - none - - - - deferred-deploy - deploy - - deploy-staged - - - - diff --git a/ci/release/Jenkinsfile b/ci/release/Jenkinsfile index f7324d54d4a..3fafe90d64d 100644 --- a/ci/release/Jenkinsfile +++ b/ci/release/Jenkinsfile @@ -68,13 +68,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 ${params.RELEASE_DRY_RUN ? '-d' : ''} \ search ${releaseVersion.toString()} ${developmentVersion.toString()} """ } diff --git a/ci/snapshot-publish/Jenkinsfile b/ci/snapshot-publish/Jenkinsfile index cc58dda587b..f5d6ce4ca76 100644 --- a/ci/snapshot-publish/Jenkinsfile +++ b/ci/snapshot-publish/Jenkinsfile @@ -33,13 +33,24 @@ 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') { + withCredentials([// 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')]) { + dir('.release/scripts') { + sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git .' + } + def version = sh( + script: ".release/scripts/determine-current-version.sh search", + returnStdout: true + ).trim() + echo "Current version: '${version}'" + sh "bash -xe .release/scripts/snapshot-deploy.sh search ${version}" + } } } } diff --git a/distribution/src/main/assembly/dist.xml b/distribution/src/main/assembly/dist.xml index b682616476c..bab0997d6d7 100644 --- a/distribution/src/main/assembly/dist.xml +++ b/distribution/src/main/assembly/dist.xml @@ -203,6 +203,7 @@ hibernate-noorm-release-scripts/** hibernate-release-scripts/** + .release/** .git diff --git a/jreleaser.yml b/jreleaser.yml new file mode 100644 index 00000000000..48ad0a7dc3a --- /dev/null +++ b/jreleaser.yml @@ -0,0 +1,58 @@ +project: + languages: + java: + groupId: org.hibernate.search + +release: + github: + skipTag: true + skipRelease: true + tagName: '{{projectVersion}}' + +# File signing is always active +signing: + mode: COMMAND + active: RELEASE + armored: true + +# Deploy JARs and POMs to Maven Central +deploy: + maven: + nexus2: + maven-central: + active: RELEASE + url: https://oss.sonatype.org/service/local + snapshotUrl: https://oss.sonatype.org/content/repositories/snapshots/ + closeRepository: true + releaseRepository: false + stagingRepositories: + - target/staging-deploy/maven + maven-central-snapshot: + active: SNAPSHOT + url: https://oss.sonatype.org/service/local + snapshotUrl: https://oss.sonatype.org/content/repositories/snapshots/ + closeRepository: true + releaseRepository: true + javadocJar: false + sign: false + stagingRepositories: + - target/staging-deploy/maven + mavenCentral: + maven-central: + # TODO: HSEARCH-5354 Change to RELEASE once switching to Maven-Central: + active: NEVER + url: https://central.sonatype.com/api/v1/publisher + snapshotSupported: false + applyMavenCentralRules: true + stagingRepositories: + - target/staging-deploy/maven + maven-central-snapshot: + # TODO: HSEARCH-5354 Change to SNAPSHOT once switching to Maven-Central: + active: NEVER + url: https://central.sonatype.com/api/v1/publisher + snapshotSupported: true + applyMavenCentralRules: true + javadocJar: false + sign: false + stagingRepositories: + - target/staging-deploy/maven diff --git a/pom.xml b/pom.xml index 90a18a7ce42..10381b4c5c3 100644 --- a/pom.xml +++ b/pom.xml @@ -270,9 +270,7 @@ 3.5.0 3.9.0 0.23.1 - 1.7.0 3.1.4 - 3.2.7 1.7.0 3.7.1 3.6.0 @@ -316,20 +314,13 @@ 2.44.4 3.1.0 - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - https://oss.sonatype.org/ - ossrh - https://oss.sonatype.org/content/repositories/snapshots - true - true + + local::file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven false @@ -555,39 +546,13 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - ${version.nexus-staging.plugin} - - ${deploy.skip} - - - org.apache.maven.plugins maven-deploy-plugin ${version.deploy.plugin} - - - - org.apache.maven.plugins - maven-gpg-plugin - ${version.gpg.plugin} - - - sign-artifacts - verify - - sign - - - ${deploy.skip} - ${env.RELEASE_GPG_HOMEDIR} - true - - - + + ${deploy.skip} + @@ -1140,44 +1105,6 @@ - - - org.apache.maven.plugins - maven-deploy-plugin - - ${maven-deploy-plugin.skip} - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - false - - ${ossrh.releases.repo.id} - - ${ossrh.releases.repo.baseUrl} - - 60 - - - - default-deploy - deploy - - - deploy - - - - org.apache.maven.plugins maven-compiler-plugin @@ -1249,19 +1176,6 @@ - - - ${ossrh.releases.repo.id} - OSSRH Releases Repository - ${ossrh.releases.repo.url} - - - ${ossrh.snapshots.repo.id} - OSSRH Snapshots Repository - ${ossrh.snapshots.repo.url} - - - @@ -1347,14 +1261,6 @@ prepare-package - - - - org.apache.maven.plugins - maven-gpg-plugin - - - @@ -1800,10 +1706,8 @@ --> reproducibility-check - false true true - true