Skip to content

Commit c682d08

Browse files
marko-bekhtakoentsje
authored andcommitted
HBX-2995: Backport release automation to branch 5.6
- Use JReleaser to publish artifacts
1 parent 43a3c33 commit c682d08

File tree

4 files changed

+31
-195
lines changed

4 files changed

+31
-195
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
@@ -59,21 +59,20 @@
5959

6060
<!-- Plugins not managed by the JBoss parent POM: -->
6161
<maven-wrapper-plugin.version>3.3.2</maven-wrapper-plugin.version>
62-
<nexus-staging.plugin.version>1.7.0</nexus-staging.plugin.version>
6362
<flatten-maven-plugin.version>1.7.0</flatten-maven-plugin.version>
6463

6564
<!--
6665
We don't want to publish or sign any modules by default.
6766
Specific modules will override the setting at their own level.
6867
-->
6968
<deploy.skip>true</deploy.skip>
70-
<maven-deploy-plugin.skip>true</maven-deploy-plugin.skip>
7169

7270
<!-- Repository Deployment URLs -->
73-
<ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
74-
<ossrh.releases.repo.name>Sonatype OSSRH Releases</ossrh.releases.repo.name>
75-
<ossrh.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2</ossrh.releases.repo.url>
76-
<ossrh.releases.repo.baseUrl>https://oss.sonatype.org</ossrh.releases.repo.baseUrl>
71+
72+
<!-- We always publish to a local directory, JReleaser is supposed to take care of publishing to Nexus: -->
73+
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
74+
<local.staging.releases.repo.name>Local Staging Directory Releases Repository</local.staging.releases.repo.name>
75+
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
7776
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
7877
<ossrh.snapshots.repo.name>Sonatype OSSRH Snapshots</ossrh.snapshots.repo.name>
7978
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
@@ -182,16 +181,16 @@
182181
</dependencyManagement>
183182

184183
<distributionManagement>
185-
<repository>
186-
<id>${ossrh.releases.repo.id}</id>
187-
<name>${ossrh.releases.repo.name}</name>
188-
<url>${ossrh.releases.repo.url}</url>
189-
</repository>
190-
<snapshotRepository>
191-
<id>${ossrh.snapshots.repo.id}</id>
192-
<name>${ossrh.snapshots.repo.name}</name>
193-
<url>${ossrh.snapshots.repo.url}</url>
194-
</snapshotRepository>
184+
<repository>
185+
<id>${local.staging.releases.repo.id}</id>
186+
<name>${local.staging.releases.repo.name}</name>
187+
<url>${local.staging.releases.repo.url}</url>
188+
</repository>
189+
<snapshotRepository>
190+
<id>${ossrh.snapshots.repo.id}</id>
191+
<name>${ossrh.snapshots.repo.name}</name>
192+
<url>${ossrh.snapshots.repo.url}</url>
193+
</snapshotRepository>
195194
</distributionManagement>
196195

197196
<build>
@@ -206,39 +205,6 @@
206205
<distributionType>bin</distributionType>
207206
</configuration>
208207
</plugin>
209-
<!-- Published artifacts have to be signed: -->
210-
<plugin>
211-
<groupId>org.apache.maven.plugins</groupId>
212-
<artifactId>maven-gpg-plugin</artifactId>
213-
<executions>
214-
<execution>
215-
<id>sign-artifacts</id>
216-
<phase>verify</phase>
217-
<goals>
218-
<goal>sign</goal>
219-
</goals>
220-
<configuration>
221-
<skip>${deploy.skip}</skip>
222-
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
223-
</configuration>
224-
</execution>
225-
</executions>
226-
</plugin>
227-
<plugin>
228-
<groupId>org.sonatype.plugins</groupId>
229-
<artifactId>nexus-staging-maven-plugin</artifactId>
230-
<version>${nexus-staging.plugin.version}</version>
231-
<extensions>false</extensions><!-- This is essential: do not put true here -->
232-
<configuration>
233-
<skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
234-
<serverId>${ossrh.releases.repo.id}</serverId>
235-
<!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
236-
<nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
237-
<!-- oss.sonatype.org has been very slow when closing repositories lately;
238-
let's raise the timeout until we switch to s01.sonatype.org -->
239-
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
240-
</configuration>
241-
</plugin>
242208
<plugin>
243209
<groupId>org.codehaus.mojo</groupId>
244210
<artifactId>flatten-maven-plugin</artifactId>
@@ -269,30 +235,9 @@
269235
<groupId>org.apache.maven.plugins</groupId>
270236
<artifactId>maven-deploy-plugin</artifactId>
271237
<configuration>
272-
<skip>${maven-deploy-plugin.skip}</skip>
238+
<skip>${deploy.skip}</skip>
273239
</configuration>
274240
</plugin>
275-
<!--
276-
Configure the nexus-staging-maven-plugin explicitly (without <extension>true</extension>)
277-
in order to work around a problem in the "reports" module (see that module's POM for more info).
278-
-->
279-
<plugin>
280-
<groupId>org.sonatype.plugins</groupId>
281-
<artifactId>nexus-staging-maven-plugin</artifactId>
282-
<executions>
283-
<execution>
284-
<id>default-deploy</id>
285-
<phase>deploy</phase>
286-
<goals>
287-
<!--
288-
This will only put artifacts in a staging directory.
289-
See the "reports" module for actual deployment, at the end of the build.
290-
-->
291-
<goal>deploy</goal>
292-
</goals>
293-
</execution>
294-
</executions>
295-
</plugin>
296241
<plugin>
297242
<groupId>org.codehaus.mojo</groupId>
298243
<artifactId>flatten-maven-plugin</artifactId>
@@ -323,44 +268,4 @@
323268
</plugins>
324269
</build>
325270

326-
<profiles>
327-
<profile>
328-
<id>release</id>
329-
<activation>
330-
<property>
331-
<name>performRelease</name>
332-
<value>true</value>
333-
</property>
334-
</activation>
335-
<build>
336-
<plugins>
337-
<plugin>
338-
<groupId>org.apache.maven.plugins</groupId>
339-
<artifactId>maven-gpg-plugin</artifactId>
340-
</plugin>
341-
</plugins>
342-
</build>
343-
</profile>
344-
345-
<!--
346-
WARNING: this MUST be the very last profile,
347-
so that the "report" module is the very last module,
348-
in particular when deploying artifacts to a Nexus repository.
349-
See the "build/reports" module POM for more information.
350-
-->
351-
<profile>
352-
<id>build-reports-as-last-module</id>
353-
<activation>
354-
<property>
355-
<name>!some.property.that.will.never.exist</name>
356-
</property>
357-
</activation>
358-
<modules>
359-
<module>reports</module>
360-
</modules>
361-
</profile>
362-
363-
<!-- DO NOT ADD ANY PROFILE AFTER THIS: see above -->
364-
</profiles>
365-
366271
</project>

reports/pom.xml

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

0 commit comments

Comments
 (0)