Skip to content

Commit 1336337

Browse files
authored
Merge pull request #332 from DataDog/vickenty/dhr
Add release process
2 parents f4c5fa7 + 192a34d commit 1336337

5 files changed

Lines changed: 159 additions & 48 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ target/
1414

1515
# rbenv for pimpmychangelog
1616
.ruby-version
17+
18+
.flattened-pom.xml

.gitlab-ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ stages:
55
variables:
66
REGISTRY: registry.ddbuild.io
77

8-
# From the tagged repo, push the release artifact
9-
deploy_to_sonatype:
8+
.sonatype_release:
109
stage: deploy_to_sonatype
1110

1211
rules:
@@ -19,6 +18,10 @@ deploy_to_sonatype:
1918

2019
image: $REGISTRY/images/mirror/maven:3.9-eclipse-temurin-17
2120

21+
variables:
22+
# Pom of the project to release, relative to the repository root.
23+
RELEASE_POM: ./pom.xml
24+
2225
script:
2326
# Ensure we don't print commands being run to the logs during credential
2427
# operations
@@ -43,8 +46,12 @@ deploy_to_sonatype:
4346

4447
- set -x
4548

46-
- echo "Building release..."
47-
- mvn -DperformRelease=true --settings ./settings.xml clean deploy
49+
- echo "Building release of $RELEASE_POM..."
50+
- mvn -DperformRelease=true --settings ./settings.xml -f "$RELEASE_POM" clean deploy
51+
52+
# From the tagged repo, push the release artifact
53+
deploy_to_sonatype:
54+
extends: .sonatype_release
4855

4956
artifacts:
5057
expire_in: 6 mos
@@ -57,6 +64,18 @@ deploy_to_sonatype:
5764
- ./target/*.sha256
5865
- ./target/*.sha512
5966

67+
deploy_dogstatsd_http:
68+
extends: .sonatype_release
69+
variables:
70+
RELEASE_POM: ./dogstatsd-http/pom.xml
71+
artifacts:
72+
expire_in: 6 mos
73+
paths:
74+
- ./dogstatsd-http/core/target/*.jar
75+
- ./dogstatsd-http/core/target/*.asc
76+
- ./dogstatsd-http/forwarder/target/*.jar
77+
- ./dogstatsd-http/forwarder/target/*.asc
78+
6079
# This job creates the GPG key used to sign the releases
6180
create_key:
6281
stage: create_key

dogstatsd-http/core/pom.xml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.datadoghq</groupId>
88
<artifactId>dogstatsd-http</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>${version}</version>
1010
</parent>
1111

1212
<artifactId>dogstatsd-http-core</artifactId>
@@ -22,23 +22,4 @@
2222
<scope>test</scope>
2323
</dependency>
2424
</dependencies>
25-
26-
<build>
27-
<plugins>
28-
<plugin>
29-
<groupId>org.apache.maven.plugins</groupId>
30-
<artifactId>maven-compiler-plugin</artifactId>
31-
<version>3.8.1</version>
32-
<configuration>
33-
<source>1.7</source>
34-
<target>1.7</target>
35-
</configuration>
36-
</plugin>
37-
<plugin>
38-
<groupId>org.apache.maven.plugins</groupId>
39-
<artifactId>maven-surefire-plugin</artifactId>
40-
<version>2.19</version>
41-
</plugin>
42-
</plugins>
43-
</build>
4425
</project>

dogstatsd-http/forwarder/pom.xml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@
66
<parent>
77
<groupId>com.datadoghq</groupId>
88
<artifactId>dogstatsd-http</artifactId>
9-
<version>1.0.0-SNAPSHOT</version>
9+
<version>${version}</version>
1010
</parent>
1111

1212
<artifactId>dogstatsd-http-forwarder</artifactId>
1313
<packaging>jar</packaging>
1414
<name>dogstatsd-http-forwarder</name>
1515
<description>HTTP forwarder for DogStatsD metrics.</description>
1616

17+
<properties>
18+
<maven.compiler.release>11</maven.compiler.release>
19+
</properties>
20+
1721
<dependencies>
1822
<dependency>
1923
<groupId>com.datadoghq</groupId>
2024
<artifactId>dogstatsd-http-core</artifactId>
21-
<version>${project.version}</version>
25+
<version>${version}</version>
2226
</dependency>
2327
<dependency>
2428
<groupId>junit</groupId>
@@ -27,23 +31,4 @@
2731
<scope>test</scope>
2832
</dependency>
2933
</dependencies>
30-
31-
<build>
32-
<plugins>
33-
<plugin>
34-
<groupId>org.apache.maven.plugins</groupId>
35-
<artifactId>maven-compiler-plugin</artifactId>
36-
<version>3.8.1</version>
37-
<configuration>
38-
<source>11</source>
39-
<target>11</target>
40-
</configuration>
41-
</plugin>
42-
<plugin>
43-
<groupId>org.apache.maven.plugins</groupId>
44-
<artifactId>maven-surefire-plugin</artifactId>
45-
<version>2.19</version>
46-
</plugin>
47-
</plugins>
48-
</build>
4934
</project>

dogstatsd-http/pom.xml

Lines changed: 127 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0"
22
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
4+
child.project.url.inherit.append.path="false">
45
<modelVersion>4.0.0</modelVersion>
56

67
<groupId>com.datadoghq</groupId>
78
<artifactId>dogstatsd-http</artifactId>
89
<packaging>pom</packaging>
910
<name>dogstatsd-http</name>
10-
<version>1.0.0-SNAPSHOT</version>
11+
<version>${version}</version>
1112
<description>Aggregator for the DogStatsD HTTP client modules.</description>
1213
<url>https://github.com/DataDog/java-dogstatsd-client</url>
1314

1415
<properties>
16+
<version>1.0.0-SNAPSHOT</version>
1517
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<maven.compiler.release>7</maven.compiler.release>
1619
</properties>
1720

1821
<licenses>
@@ -23,7 +26,9 @@
2326
</license>
2427
</licenses>
2528

26-
<scm>
29+
<scm child.scm.url.inherit.append.path="false"
30+
child.scm.connection.inherit.append.path="false"
31+
child.scm.developerConnection.inherit.append.path="false">
2732
<url>https://github.com/DataDog/java-dogstatsd-client</url>
2833
<connection>scm:git:git@github.com:DataDog/java-dogstatsd-client.git</connection>
2934
<developerConnection>scm:git:git@github.com:Datadog/java-dogstatsd-client.git</developerConnection>
@@ -37,6 +42,47 @@
3742
</developer>
3843
</developers>
3944

45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<version>3.8.1</version>
51+
<configuration>
52+
<release>${maven.compiler.release}</release>
53+
</configuration>
54+
</plugin>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-surefire-plugin</artifactId>
58+
<version>2.19</version>
59+
</plugin>
60+
<plugin>
61+
<groupId>org.codehaus.mojo</groupId>
62+
<artifactId>flatten-maven-plugin</artifactId>
63+
<version>1.8.0</version>
64+
<configuration>
65+
<flattenMode>ossrh</flattenMode>
66+
</configuration>
67+
<executions>
68+
<execution>
69+
<id>flatten</id>
70+
<phase>process-resources</phase>
71+
<goals>
72+
<goal>flatten</goal>
73+
</goals>
74+
</execution>
75+
<execution>
76+
<id>flatten.clean</id>
77+
<goals>
78+
<goal>clean</goal>
79+
</goals>
80+
</execution>
81+
</executions>
82+
</plugin>
83+
</plugins>
84+
</build>
85+
4086
<profiles>
4187
<profile>
4288
<id>spotless</id>
@@ -68,6 +114,84 @@
68114
</plugins>
69115
</build>
70116
</profile>
117+
118+
<profile>
119+
<id>deploy-artifacts</id>
120+
<activation>
121+
<activeByDefault>false</activeByDefault>
122+
<property>
123+
<name>performRelease</name>
124+
<value>true</value>
125+
</property>
126+
</activation>
127+
<build>
128+
<plugins>
129+
<plugin>
130+
<groupId>org.apache.maven.plugins</groupId>
131+
<artifactId>maven-source-plugin</artifactId>
132+
<version>2.4</version>
133+
<executions>
134+
<execution>
135+
<id>attach-sources</id>
136+
<goals>
137+
<goal>jar</goal>
138+
</goals>
139+
</execution>
140+
</executions>
141+
</plugin>
142+
<plugin>
143+
<groupId>org.apache.maven.plugins</groupId>
144+
<artifactId>maven-javadoc-plugin</artifactId>
145+
<version>3.1.0</version>
146+
<executions>
147+
<execution>
148+
<id>attach-javadocs</id>
149+
<goals>
150+
<goal>jar</goal>
151+
</goals>
152+
</execution>
153+
</executions>
154+
</plugin>
155+
<plugin>
156+
<groupId>org.sonatype.central</groupId>
157+
<artifactId>central-publishing-maven-plugin</artifactId>
158+
<version>0.8.0</version>
159+
<extensions>true</extensions>
160+
<configuration>
161+
<publishingServerId>central</publishingServerId>
162+
<waitUntil>validated</waitUntil>
163+
<deploymentName>dogstatsd-http:${project.version}</deploymentName>
164+
<!-- The aggregator pom is build-time only: children are flattened
165+
into standalone poms with no parent reference, so it is never
166+
resolved by consumers and must not be published. -->
167+
<excludeArtifacts>
168+
<excludeArtifact>dogstatsd-http</excludeArtifact>
169+
</excludeArtifacts>
170+
</configuration>
171+
</plugin>
172+
<plugin>
173+
<groupId>org.apache.maven.plugins</groupId>
174+
<artifactId>maven-gpg-plugin</artifactId>
175+
<version>1.6</version>
176+
<executions>
177+
<execution>
178+
<id>sign-artifacts</id>
179+
<phase>verify</phase>
180+
<goals>
181+
<goal>sign</goal>
182+
</goals>
183+
<configuration>
184+
<gpgArguments>
185+
<arg>--pinentry-mode</arg>
186+
<arg>loopback</arg>
187+
</gpgArguments>
188+
</configuration>
189+
</execution>
190+
</executions>
191+
</plugin>
192+
</plugins>
193+
</build>
194+
</profile>
71195
</profiles>
72196

73197
<modules>

0 commit comments

Comments
 (0)