Skip to content

Commit 0c75afd

Browse files
marko-bekhtakoentsje
authored andcommitted
HBX-2985 Use JReleaser to publish artifacts
1 parent 1766b46 commit 0c75afd

File tree

4 files changed

+31
-210
lines changed

4 files changed

+31
-210
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: 16 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,20 @@
104104

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

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

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

249248
<distributionManagement>
250-
<repository>
251-
<id>${ossrh.releases.repo.id}</id>
252-
<name>${ossrh.releases.repo.name}</name>
253-
<url>${ossrh.releases.repo.url}</url>
254-
</repository>
255-
<snapshotRepository>
256-
<id>${ossrh.snapshots.repo.id}</id>
257-
<name>${ossrh.snapshots.repo.name}</name>
258-
<url>${ossrh.snapshots.repo.url}</url>
259-
</snapshotRepository>
249+
<repository>
250+
<id>${local.staging.releases.repo.id}</id>
251+
<name>${local.staging.releases.repo.name}</name>
252+
<url>${local.staging.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>
260259
</distributionManagement>
261260

262261

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

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

reports/pom.xml

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

0 commit comments

Comments
 (0)