Skip to content

Commit 647dff8

Browse files
marko-bekhtakoentsje
authored andcommitted
HBX-2994: Backport automated releases to branch 6.4
- Use JReleaser to publish artifacts
1 parent d567f4f commit 647dff8

File tree

4 files changed

+32
-216
lines changed

4 files changed

+32
-216
lines changed

.release/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# The folder into which we checkout our release scripts into
2+
*
3+
!.gitignore

ci/release/Jenkinsfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pipeline {
7474

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

7980
withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
@@ -82,13 +83,20 @@ pipeline {
8283
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: env.HOME + '/.ssh/known_hosts')]) {
8384
// using MAVEN_GPG_PASSPHRASE (the default env variable name for passphrase in maven gpg plugin)
8485
withCredentials([file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
85-
string(credentialsId: 'release.gpg.passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) {
86+
string(credentialsId: 'release.gpg.passphrase', variable: 'JRELEASER_GPG_PASSPHRASE'),
87+
// TODO: Once we switch to maven-central publishing (from nexus2) we need to add a new credentials
88+
// to use the following env variable names to set the user/password:
89+
// JRELEASER_MAVENCENTRAL_USERNAME
90+
// JRELEASER_MAVENCENTRAL_TOKEN
91+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'JRELEASER_NEXUS2_PASSWORD', usernameVariable: 'JRELEASER_NEXUS2_USERNAME'),
92+
string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN')]) {
8693
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
8794
sh 'cat $HOME/.ssh/config'
88-
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git'
89-
env.RELEASE_GPG_HOMEDIR = env.WORKSPACE_TMP + '/.gpg'
95+
dir('.release/scripts') {
96+
sh 'git clone https://github.com/hibernate/hibernate-release-scripts.git .'
97+
}
9098
sh """
91-
bash -xe hibernate-release-scripts/release.sh ${params.RELEASE_DRY_RUN ? '-d' : ''} \
99+
bash -xe .release/scripts/release.sh -j ${params.RELEASE_DRY_RUN ? '-d' : ''} \
92100
tools ${releaseVersion.toString()} ${developmentVersion.toString()}
93101
"""
94102
}

pom.xml

Lines changed: 17 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,20 @@
103103

104104
<!-- Plugins not managed by the JBoss parent POM: -->
105105
<maven-wrapper-plugin.version>3.3.2</maven-wrapper-plugin.version>
106-
<nexus-staging.plugin.version>1.7.0</nexus-staging.plugin.version>
107-
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
106+
<flatten-maven-plugin.version>1.7.0</flatten-maven-plugin.version>
108107

109108
<!--
110109
We don't want to publish or sign any modules by default.
111110
Specific modules will override the setting at their own level.
112111
-->
113112
<deploy.skip>true</deploy.skip>
114-
<maven-deploy-plugin.skip>true</maven-deploy-plugin.skip>
115113

116114
<!-- Repository Deployment URLs -->
117-
<ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
118-
<ossrh.releases.repo.name>Sonatype OSSRH Releases</ossrh.releases.repo.name>
119-
<ossrh.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2</ossrh.releases.repo.url>
120-
<ossrh.releases.repo.baseUrl>https://oss.sonatype.org</ossrh.releases.repo.baseUrl>
115+
116+
<!-- We always publish to a local directory, JReleaser is supposed to take care of publishing to Nexus: -->
117+
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
118+
<local.staging.releases.repo.name>Local Staging Directory Releases Repository</local.staging.releases.repo.name>
119+
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
121120
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
122121
<ossrh.snapshots.repo.name>Sonatype OSSRH Snapshots</ossrh.snapshots.repo.name>
123122
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
@@ -246,16 +245,16 @@
246245
</dependencyManagement>
247246

248247
<distributionManagement>
249-
<repository>
250-
<id>${ossrh.releases.repo.id}</id>
251-
<name>${ossrh.releases.repo.name}</name>
252-
<url>${ossrh.releases.repo.url}</url>
253-
</repository>
254-
<snapshotRepository>
255-
<id>${ossrh.snapshots.repo.id}</id>
256-
<name>${ossrh.snapshots.repo.name}</name>
257-
<url>${ossrh.snapshots.repo.url}</url>
258-
</snapshotRepository>
248+
<repository>
249+
<id>${local.staging.releases.repo.id}</id>
250+
<name>${local.staging.releases.repo.name}</name>
251+
<url>${local.staging.releases.repo.url}</url>
252+
</repository>
253+
<snapshotRepository>
254+
<id>${ossrh.snapshots.repo.id}</id>
255+
<name>${ossrh.snapshots.repo.name}</name>
256+
<url>${ossrh.snapshots.repo.url}</url>
257+
</snapshotRepository>
259258
</distributionManagement>
260259

261260
<build>
@@ -270,39 +269,6 @@
270269
<distributionType>bin</distributionType>
271270
</configuration>
272271
</plugin>
273-
<!-- Published artifacts have to be signed: -->
274-
<plugin>
275-
<groupId>org.apache.maven.plugins</groupId>
276-
<artifactId>maven-gpg-plugin</artifactId>
277-
<executions>
278-
<execution>
279-
<id>sign-artifacts</id>
280-
<phase>verify</phase>
281-
<goals>
282-
<goal>sign</goal>
283-
</goals>
284-
<configuration>
285-
<skip>${deploy.skip}</skip>
286-
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
287-
</configuration>
288-
</execution>
289-
</executions>
290-
</plugin>
291-
<plugin>
292-
<groupId>org.sonatype.plugins</groupId>
293-
<artifactId>nexus-staging-maven-plugin</artifactId>
294-
<version>${nexus-staging.plugin.version}</version>
295-
<extensions>false</extensions><!-- This is essential: do not put true here -->
296-
<configuration>
297-
<skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
298-
<serverId>${ossrh.releases.repo.id}</serverId>
299-
<!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
300-
<nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
301-
<!-- oss.sonatype.org has been very slow when closing repositories lately;
302-
let's raise the timeout until we switch to s01.sonatype.org -->
303-
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
304-
</configuration>
305-
</plugin>
306272
<plugin>
307273
<groupId>org.codehaus.mojo</groupId>
308274
<artifactId>flatten-maven-plugin</artifactId>
@@ -333,30 +299,9 @@
333299
<groupId>org.apache.maven.plugins</groupId>
334300
<artifactId>maven-deploy-plugin</artifactId>
335301
<configuration>
336-
<skip>${maven-deploy-plugin.skip}</skip>
302+
<skip>${deploy.skip}</skip>
337303
</configuration>
338304
</plugin>
339-
<!--
340-
Configure the nexus-staging-maven-plugin explicitly (without <extension>true</extension>)
341-
in order to work around a problem in the "reports" module (see that module's POM for more info).
342-
-->
343-
<plugin>
344-
<groupId>org.sonatype.plugins</groupId>
345-
<artifactId>nexus-staging-maven-plugin</artifactId>
346-
<executions>
347-
<execution>
348-
<id>default-deploy</id>
349-
<phase>deploy</phase>
350-
<goals>
351-
<!--
352-
This will only put artifacts in a staging directory.
353-
See the "reports" module for actual deployment, at the end of the build.
354-
-->
355-
<goal>deploy</goal>
356-
</goals>
357-
</execution>
358-
</executions>
359-
</plugin>
360305
<plugin>
361306
<groupId>org.codehaus.mojo</groupId>
362307
<artifactId>flatten-maven-plugin</artifactId>
@@ -387,44 +332,4 @@
387332
</plugins>
388333
</build>
389334

390-
<profiles>
391-
<profile>
392-
<id>release</id>
393-
<activation>
394-
<property>
395-
<name>performRelease</name>
396-
<value>true</value>
397-
</property>
398-
</activation>
399-
<build>
400-
<plugins>
401-
<plugin>
402-
<groupId>org.apache.maven.plugins</groupId>
403-
<artifactId>maven-gpg-plugin</artifactId>
404-
</plugin>
405-
</plugins>
406-
</build>
407-
</profile>
408-
409-
<!--
410-
WARNING: this MUST be the very last profile,
411-
so that the "report" module is the very last module,
412-
in particular when deploying artifacts to a Nexus repository.
413-
See the "build/reports" module POM for more information.
414-
-->
415-
<profile>
416-
<id>build-reports-as-last-module</id>
417-
<activation>
418-
<property>
419-
<name>!some.property.that.will.never.exist</name>
420-
</property>
421-
</activation>
422-
<modules>
423-
<module>reports</module>
424-
</modules>
425-
</profile>
426-
427-
<!-- DO NOT ADD ANY PROFILE AFTER THIS: see above -->
428-
</profiles>
429-
430335
</project>

reports/pom.xml

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)