@@ -119,8 +119,10 @@ pipeline {
119119 echo " Release was triggered automatically"
120120
121121 // Avoid doing an automatic release for commits from a release
122- def lastCommitter = sh(script : ' git show -s --format=\' %an\' ' , returnStdout : true )
123- def secondLastCommitter = sh(script : ' git show -s --format=\' %an\' HEAD~1' , returnStdout : true )
122+ def lastCommitter = sh(script : ' git show -s --format=\' %an\' ' , returnStdout : true ). trim()
123+ def secondLastCommitter = sh(script : ' git show -s --format=\' %an\' HEAD~1' , returnStdout : true ). trim()
124+ echo " Last two commits were performed by '${ lastCommitter} '/'${ secondLastCommitter} '."
125+
124126 if (lastCommitter == ' Hibernate-CI' && secondLastCommitter == ' Hibernate-CI' ) {
125127 print " INFO: Automatic release skipped because last commits were for the previous release"
126128 currentBuild. result = ' ABORTED'
@@ -149,6 +151,7 @@ pipeline {
149151 env. DEVELOPMENT_VERSION = developmentVersion. toString()
150152 // Dry run is not supported at the moment
151153 env. SCRIPT_OPTIONS = params. RELEASE_DRY_RUN ? " -d" : " "
154+ env. JRELEASER_DRY_RUN = true
152155
153156 // Determine version id to check if Jira version exists
154157 // This step doesn't work for Hibernate Reactive (the project has been created with a different type on JIRA)
@@ -172,11 +175,10 @@ pipeline {
172175 // tags the version
173176 // changes the version to the provided development version
174177 withEnv([
175- " BRANCH=${ env.GIT_BRANCH} " ,
176178 // Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
177179 " GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'"
178180 ]) {
179- sh " .release/scripts/prepare-release.sh ${ env.PROJECT } ${ env.RELEASE_VERSION } ${ env.DEVELOPMENT_VERSION } "
181+ sh " .release/scripts/prepare-release.sh -b ${ env.GIT_BRANCH } -d ${ env.DEVELOPMENT_VERSION } ${ env.PROJECT } ${ env.RELEASE_VERSION } "
180182 }
181183 }
182184 }
@@ -193,11 +195,17 @@ pipeline {
193195 configFile(fileId : ' release.config.ssh.knownhosts' , targetLocation : " ${ env.HOME} /.ssh/known_hosts" )
194196 ]) {
195197 withCredentials([
196- // https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
197- usernamePassword(credentialsId : ' ossrh.sonatype.org' , passwordVariable : ' ORG_GRADLE_PROJECT_sonatypePassword' , usernameVariable : ' ORG_GRADLE_PROJECT_sonatypeUsername' ),
198- file(credentialsId : ' release.gpg.private-key' , variable : ' SIGNING_GPG_PRIVATE_KEY_PATH' ),
199- string(credentialsId : ' release.gpg.passphrase' , variable : ' SIGNING_GPG_PASSPHRASE' ),
200- gitUsernamePassword(credentialsId : ' username-and-token.Hibernate-CI.github.com' , gitToolName : ' Default' )
198+ // TODO: Once we switch to maven-central publishing (from nexus2) we need to add a new credentials
199+ // to use the following env variable names to set the user/password:
200+ // - JRELEASER_MAVENCENTRAL_USERNAME
201+ // - JRELEASER_MAVENCENTRAL_TOKEN
202+ // Also use the new `credentialsId` for Maven Central, e.g.:
203+ // usernamePassword(credentialsId: '???????', passwordVariable: 'JRELEASER_MAVENCENTRAL_TOKEN', usernameVariable: 'JRELEASER_MAVENCENTRAL_USERNAME'),
204+ usernamePassword(credentialsId : ' ossrh.sonatype.org' , passwordVariable : ' JRELEASER_NEXUS2_PASSWORD' , usernameVariable : ' JRELEASER_NEXUS2_USERNAME' ),
205+ gitUsernamePassword(credentialsId : ' username-and-token.Hibernate-CI.github.com' , gitToolName : ' Default' ),
206+ file(credentialsId : ' release.gpg.private-key' , variable : ' RELEASE_GPG_PRIVATE_KEY_PATH' ),
207+ string(credentialsId : ' release.gpg.passphrase' , variable : ' JRELEASER_GPG_PASSPHRASE' ),
208+ string(credentialsId : ' Hibernate-CI.github.com' , variable : ' JRELEASER_GITHUB_TOKEN' )
201209 ]) {
202210 sshagent([' ed25519.Hibernate-CI.github.com' , ' hibernate.filemgmt.jboss.org' , ' hibernate-ci.frs.sourceforge.net' ]) {
203211 // performs documentation upload and Sonatype release
@@ -217,4 +225,4 @@ pipeline {
217225 }
218226 }
219227 }
220- }
228+ }
0 commit comments