Skip to content

Commit 647bfd2

Browse files
marko-bekhtakoentsje
authored andcommitted
HBX-2985 Use JReleaser to publish artifacts
1 parent fccba37 commit 647bfd2

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
@@ -46,21 +46,20 @@
4646

4747
<!-- Plugins not managed by the JBoss parent POM: -->
4848
<maven-wrapper-plugin.version>3.3.2</maven-wrapper-plugin.version>
49-
<nexus-staging.plugin.version>1.7.0</nexus-staging.plugin.version>
5049
<flatten-maven-plugin.version>1.7.0</flatten-maven-plugin.version>
5150

5251
<!--
5352
We don't want to publish or sign any modules by default.
5453
Specific modules will override the setting at their own level.
5554
-->
5655
<deploy.skip>true</deploy.skip>
57-
<maven-deploy-plugin.skip>true</maven-deploy-plugin.skip>
5856

5957
<!-- Repository Deployment URLs -->
60-
<ossrh.releases.repo.id>ossrh</ossrh.releases.repo.id>
61-
<ossrh.releases.repo.name>Sonatype OSSRH Releases</ossrh.releases.repo.name>
62-
<ossrh.releases.repo.url>https://oss.sonatype.org/service/local/staging/deploy/maven2</ossrh.releases.repo.url>
63-
<ossrh.releases.repo.baseUrl>https://oss.sonatype.org</ossrh.releases.repo.baseUrl>
58+
59+
<!-- We always publish to a local directory, JReleaser is supposed to take care of publishing to Nexus: -->
60+
<local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
61+
<local.staging.releases.repo.name>Local Staging Directory Releases Repository</local.staging.releases.repo.name>
62+
<local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
6463
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
6564
<ossrh.snapshots.repo.name>Sonatype OSSRH Snapshots</ossrh.snapshots.repo.name>
6665
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
@@ -175,16 +174,16 @@
175174
</dependencyManagement>
176175

177176
<distributionManagement>
178-
<repository>
179-
<id>${ossrh.releases.repo.id}</id>
180-
<name>${ossrh.releases.repo.name}</name>
181-
<url>${ossrh.releases.repo.url}</url>
182-
</repository>
183-
<snapshotRepository>
184-
<id>${ossrh.snapshots.repo.id}</id>
185-
<name>${ossrh.snapshots.repo.name}</name>
186-
<url>${ossrh.snapshots.repo.url}</url>
187-
</snapshotRepository>
177+
<repository>
178+
<id>${local.staging.releases.repo.id}</id>
179+
<name>${local.staging.releases.repo.name}</name>
180+
<url>${local.staging.releases.repo.url}</url>
181+
</repository>
182+
<snapshotRepository>
183+
<id>${ossrh.snapshots.repo.id}</id>
184+
<name>${ossrh.snapshots.repo.name}</name>
185+
<url>${ossrh.snapshots.repo.url}</url>
186+
</snapshotRepository>
188187
</distributionManagement>
189188

190189
<build>
@@ -199,39 +198,6 @@
199198
<distributionType>bin</distributionType>
200199
</configuration>
201200
</plugin>
202-
<!-- Published artifacts have to be signed: -->
203-
<plugin>
204-
<groupId>org.apache.maven.plugins</groupId>
205-
<artifactId>maven-gpg-plugin</artifactId>
206-
<executions>
207-
<execution>
208-
<id>sign-artifacts</id>
209-
<phase>verify</phase>
210-
<goals>
211-
<goal>sign</goal>
212-
</goals>
213-
<configuration>
214-
<skip>${deploy.skip}</skip>
215-
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
216-
</configuration>
217-
</execution>
218-
</executions>
219-
</plugin>
220-
<plugin>
221-
<groupId>org.sonatype.plugins</groupId>
222-
<artifactId>nexus-staging-maven-plugin</artifactId>
223-
<version>${nexus-staging.plugin.version}</version>
224-
<extensions>false</extensions><!-- This is essential: do not put true here -->
225-
<configuration>
226-
<skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
227-
<serverId>${ossrh.releases.repo.id}</serverId>
228-
<!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
229-
<nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
230-
<!-- oss.sonatype.org has been very slow when closing repositories lately;
231-
let's raise the timeout until we switch to s01.sonatype.org -->
232-
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
233-
</configuration>
234-
</plugin>
235201
<plugin>
236202
<groupId>org.codehaus.mojo</groupId>
237203
<artifactId>flatten-maven-plugin</artifactId>
@@ -262,30 +228,9 @@
262228
<groupId>org.apache.maven.plugins</groupId>
263229
<artifactId>maven-deploy-plugin</artifactId>
264230
<configuration>
265-
<skip>${maven-deploy-plugin.skip}</skip>
231+
<skip>${deploy.skip}</skip>
266232
</configuration>
267233
</plugin>
268-
<!--
269-
Configure the nexus-staging-maven-plugin explicitly (without <extension>true</extension>)
270-
in order to work around a problem in the "reports" module (see that module's POM for more info).
271-
-->
272-
<plugin>
273-
<groupId>org.sonatype.plugins</groupId>
274-
<artifactId>nexus-staging-maven-plugin</artifactId>
275-
<executions>
276-
<execution>
277-
<id>default-deploy</id>
278-
<phase>deploy</phase>
279-
<goals>
280-
<!--
281-
This will only put artifacts in a staging directory.
282-
See the "reports" module for actual deployment, at the end of the build.
283-
-->
284-
<goal>deploy</goal>
285-
</goals>
286-
</execution>
287-
</executions>
288-
</plugin>
289234
<plugin>
290235
<groupId>org.codehaus.mojo</groupId>
291236
<artifactId>flatten-maven-plugin</artifactId>
@@ -316,44 +261,4 @@
316261
</plugins>
317262
</build>
318263

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

reports/pom.xml

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

0 commit comments

Comments
 (0)