8000 HBX-2951: Backport automated releases to branch 6.6 · hibernate/hibernate-tools@32bb187 · GitHub
[go: up one dir, main page]

Skip to content

Commit 32bb187

Browse files
committed
HBX-2951: Backport automated releases to branch 6.6
- Add 'reports' module - Modify pom.xml with following changes/additions: * Add needed properties for the CI run * Modify the 'distributionManagement' section with the needed deployment info * Add a 'build' section to (1) sign the artefacts to deploy (2) perform deployment to the sonatype repo (3) flatten the pom files * Add a 'profile' section for the release Signed-off-by: Koen Aers <koen.aers@gmail.com>
1 parent 71cbca2 commit 32bb187

File tree

2 files changed

+280
-28
lines changed

2 files changed

+280
-28
lines changed

pom.xml

Lines changed: 180 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@
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>
108+
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
109+
110+
<!--
111+
We don't want to publish or sign any modules by default.
112+
Specific modules will override the setting at their own level.
113+
-->
114+
<deploy.skip>true</deploy.skip>
115+
<maven-deploy-plugin.skip>true</maven-deploy-plugin.skip>
116+
117+
<!-- 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>
122+
<ossrh.snapshots.repo.id>ossrh</ossrh.snapshots.repo.id>
123+
<ossrh.snapshots.repo.name>Sonatype OSSRH Snapshots</ossrh.snapshots.repo.name>
124+
<ossrh.snapshots.repo.url>https://oss.sonatype.org/content/repositories/snapshots</ossrh.snapshots.repo.url>
107125

108126
<maven.compiler.target>11</maven.compiler.target>
109127
<maven.compiler.source>11</maven.compiler.source>
@@ -228,36 +246,17 @@
228246
</dependencies>
229247
</dependencyManagement>
230248

231-
<repositories>
249+
<distributionManagement>
232250
<repository>
233-
<snapshots>
234-
<enabled>false</enabled>
235-
</snapshots>
236-
<id>ossrh-releases-repository</id>
237-
<name>Sonatype OSSRH Releases</name>
238-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
251+
<id>${ossrh.releases.repo.id}</id>
252+
<name>${ossrh.releases.repo.name}</name>
253+
<url>${ossrh.releases.repo.url}</url>
239254
</repository>
240-
<repository>
241-
<snapshots>
242-
<enabled>true</enabled>
243-
</snapshots>
244-
<id>ossrh-snapshots-repository</id>
245-
<name>Sonatype OSSRH Snapshots</name>
246-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
247-
</repository>
248-
</repositories>
249-
250-
<distributionManagement>
251-
<repository>
252-
<id>ossrh-releases-repository</id>
253-
<name>Sonatype OSSRH Releases</name>
254-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
255-
</repository>
256-
<snapshotRepository>
257-
<id>ossrh-snapshots-repository</id>
258-
<name>Sonatype OSSRH Snapshots</name>
259-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
260-
</snapshotRepository>
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>
261260
</distributionManagement>
262261

263262
<build>
@@ -272,8 +271,161 @@
272271
<distributionType>bin</distributionType>
273272
</configuration>
274273
</plugin>
274+
<!-- Published artifacts have to be signed: -->
275+
<plugin>
276+
<groupId>org.apache.maven.plugins</groupId>
277+
<artifactId>maven-gpg-plugin</artifactId>
278+
<executions>
279+
<execution>
280+
<id>sign-artifacts</id>
281+
<phase>verify</phase>
282+
<goals>
283+
<goal>sign</goal>
284+
</goals>
285+
<configuration>
286+
<skip>${deploy.skip}</skip>
287+
<homedir>${env.RELEASE_GPG_HOMEDIR}</homedir>
288+
</configuration>
289+
</execution>
290+
</executions>
291+
</plugin>
292+
<plugin>
293+
<groupId>org.sonatype.plugins</groupId>
294+
<artifactId>nexus-staging-maven-plugin</artifactId>
295+
<version>${nexus-staging.plugin.version}</version>
296+
<extensions>false</extensions><!-- This is essential: do not put true here -->
297+
<configuration>
298+
<skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
299+
<serverId>${ossrh.releases.repo.id}</serverId>
300+
<!-- The following, by default, is only used for actual releases, not for snapshot deployments -->
301+
<nexusUrl>${ossrh.releases.repo.baseUrl}</nexusUrl>
302+
<!-- oss.sonatype.org has been very slow when closing repositories lately;
303+
let's raise the timeout until we switch to s01.sonatype.org -->
304+
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
305+
</configuration>
F438 306+
</plugin>
307+
<plugin>
308+
<groupId>org.codehaus.mojo</groupId>
309+
<artifactId>flatten-maven-plugin</artifactId>
310+
<version>${flatten-maven-plugin.version}</version>
311+
<configuration>
312+
<outputDirectory>${project.build.directory}</outputDirectory>
313+
<!-- Keep things like url, inceptionYear, authors...
314+
everything that's required by the OSSRH Maven repository -->
315+
<flattenMode>ossrh</flattenMode>
316+
<!-- To make sure that `hibernate-tools-gradle` module that has a pom packaging will also publish the flattened pom -->
317+
<updatePomFile>true</updatePomFile>
318+
</configuration>
319+
<executions>
320+
<execution>
321+
<id>flatten-pom</id>
322+
<phase>process-resources</phase>
323+
<goals>
324+
<goal>flatten</goal>
325+
</goals>
326+
</execution>
327+
</executions>
328+
</plugin>
275329
</plugins>
276330
</pluginManagement>
331+
<plugins>
332+
<!-- Skip the deploy plugin explicitly: we use nexus-staging-maven-plugin instead -->
333+
<plugin>
334+
<groupId>org.apache.maven.plugins</groupId>
335+
<artifactId>maven-deploy-plugin</artifactId>
336+
<configuration>
337+
<skip>${maven-deploy-plugin.skip}</skip>
338+
</configuration>
339+
</plugin>
340+
<!--
341+
Configure the nexus-staging-maven-plugin explicitly (without <extension>true</extension>)
342+
in order to work around a problem in the "reports" module (see that module's POM for more info).
343+
-->
344+
<plugin>
345+
<groupId>org.sonatype.plugins</groupId>
346+
<artifactId>nexus-staging-maven-plugin</artifactId>
347+
<executions>
348+
<execution>
349+
<id>default-deploy</id>
350+
<phase>deploy</phase>
351+
<goals>
352+
<!--
353+
This will only put artifacts in a staging directory.
354+
See the "reports" module for actual deployment, at the end of the build.
355+
-->
356+
<goal>deploy</goal>
357+
</goals>
358+
</execution>
359+
</executions>
360+
</plugin>
361+
<plugin>
362+
<groupId>org.codehaus.mojo</groupId>
363+
<artifactId>flatten-maven-plugin</artifactId>
364+
</plugin>
365+
<plugin>
366+
<groupId>org.apache.maven.plugins</groupId>
367+
<artifactId>maven-enforcer-plugin</artifactId>
368+
<executions>
369+
<execution>
370+
<id>enforce-java-version</id>
371+
<goals>
372+
<goal>enforce</goal>
373+
</goals>
374+
<configuration>
375+
<!--
376+
We want to override the rules for this configuration to remove the bannedRepositories rule from the JBoss parent.
377+
-->
378+
<rules combine.self="override">
379+
<requireJavaVersion>
380+
<message>To build this project JDK ${jdk.min.version} (or greater) is required. Please install it.</message>
381+
<version>${jdk.min.version}</version>
382+
</requireJavaVersion>
383+
</rules>
384+
</configuration>
385+
</execution>
386+
</executions>
387+
</plugin>
388+
</plugins>
277389
</build>
278390

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

reports/pom.xml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2016 - 2024 Red Hat, Inc.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" basis,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<parent>
21+
<groupId>org.hibernate.tool</groupId>
22+
<artifactId>hibernate-tools-parent</artifactId>
23+
<version>6.6.3-SNAPSHOT</version>
24+
</parent>
25+
<artifactId>hibernate-tools-reports</artifactId>
26+
27+
<name>Hibernate Tools Reports</name>
28+
<description>Hibernate Tools build reports</description>
29+
<packaging>pom</packaging>
30+
31+
<dependencies>
32+
<dependency>
33+
<groupId>org.hibernate.tool</groupId>
34+
<artifactId>hibernate-tools-utils</artifactId>
35+
<version>${project.version}</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.hibernate.tool</groupId>
39+
<artifactId>hibernate-tools-orm</artifactId>
40+
<version>${project.version}</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.hibernate.tool</groupId>
44+
<artifactId>hibernate-tools-orm-jbt</artifactId>
45+
<version>${project.version}</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.hibernate.tool</groupId>
49+
<artifactId>hibernate-tools-maven</artifactId>
50+
<version>${project.version}</version>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.hibernate.tool</groupId>
54+
<artifactId>hibernate-tools-gradle</artifactId>
55+
<version>${project.version}</version>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.hibernate.tool</groupId>
59+
<artifactId>hibernate-tools-ant</artifactId>
60+
<version>${project.version}</version>
61+
</dependency>
62+
</dependencies>
63+
64+
<build>
65+
<plugins>
66+
<!--
67+
Hack to deploy in the "reports" module without deploying the "reports" module itself.
68+
The default lifecycle bindings of the plugin is to "stage locally" every artifact throughout
69+
the maven execution, and only actually deploy the "locally staged" artifacts
70+
in the very last executed module, which happens to be this "reports" module.
71+
However, this "reports" module does not generate any artifact we want to deploy.
72+
Thus, we'd like to prevent even its POM from being deployed: just deploy the "locally staged" artifacts,
73+
without adding the POM from the "reports" module to these artifacts.
74+
The default lifecycle bindings of the plugin does not offer a configuration option to do that,
75+
so we have to explicitly bind it
76+
-->
77+
<plugin>
78+
<groupId>org.sonatype.plugins</groupId>
79+
<artifactId>nexus-staging-maven-plugin</artifactId>
80+
<extensions>false</extensions>
81+
<!-- The <configuration> element is inherited from the parent module. -->
82+
<executions>
83+
<!-- Skip the default deployment, as explained above we don't want it. -->
84+
<execution>
85+
<id>default-deploy</id>
86+
<phase>none</phase>
87+
</execution>
88+
<!-- ... but execute the deferred deployment for the other modules -->
89+
<execution>
90+
<id>deferred-deploy</id>
91+
<phase>deploy</phase>
92+
<goals>
93+
<goal>deploy-staged</goal>
94+
</goals>
95+
</execution>
96+
</executions>
97+
</plugin>
98+
</plugins>
99+
</build>
100+
</project>

0 commit comments

Comments
 (0)
0