Skip to content

Commit fcd91fe

Browse files
build: Sonatype configuration and Maven plugins (#165)
Integrated Maven GPG, Deploy, and Nexus Staging plugins to enable artifact signing and deployment. Configured Sonatype repository profiles and updated settings for Sonatype server credentials. Removed outdated Java version comment. Resolves #79
1 parent 4368840 commit fcd91fe

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

.github/workflows/release.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ jobs:
3939
java-version: "11"
4040
distribution: "adopt"
4141
server-id: github
42+
server-username: MAVEN_USERNAME
43+
server-password: MAVEN_PASSWORD
44+
gpg-private-key: ${{ secrets.OPENTDF_GPG_KEY }}
45+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
4246
- name: Publish package
43-
run: mvn --batch-mode deploy
47+
run: mvn --batch-mode deploy -DskipTests
4448
env:
4549
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4650
BUF_INPUT_HTTPS_USERNAME: opentdf-bot
4751
BUF_INPUT_HTTPS_PASSWORD: ${{ secrets.PERSONAL_ACCESS_TOKEN_OPENTDF }}
52+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
53+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
54+
MAVEN_GPG_PASSPHRASE: ${{ secrets.OPENTDF_GPG_KEY_PASSPHRASE }}

pom.xml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
<packaging>pom</packaging>
1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<!-- TODO: Move to new version of Java-->
1615
<maven.compiler.source>11</maven.compiler.source>
1716
<maven.compiler.target>11</maven.compiler.target>
1817
<log4j.version>2.20.0</log4j.version>
1918
<grpc.version>1.63.0</grpc.version>
2019
<protobuf.version>3.25.3</protobuf.version>
2120
<sslcontext.version>8.3.5</sslcontext.version>
2221
</properties>
22+
<scm>
23+
<connection>scm:git:https://github.com/opentdf/java-sdk.git</connection>
24+
<developerConnection>scm:git:git@github.com:opentdf/java-sdk.git</developerConnection>
25+
<url>https://github.com/opentdf/java-sdk</url>
26+
</scm>
2327
<modules>
2428
<module>sdk</module>
2529
<module>cmdline</module>
@@ -149,6 +153,14 @@
149153
<artifactId>maven-deploy-plugin</artifactId>
150154
<version>2.8.2</version>
151155
</plugin>
156+
<plugin>
157+
<artifactId>maven-gpg-plugin</artifactId>
158+
<version>3.2.3</version>
159+
</plugin>
160+
<plugin>
161+
<artifactId>nexus-staging-maven-plugin</artifactId>
162+
<version>1.7.0</version>
163+
</plugin>
152164
<!-- site lifecycle, see
153165
https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
154166
<plugin>
@@ -176,6 +188,43 @@
176188
</plugins>
177189
</pluginManagement>
178190
<plugins>
191+
<!-- Plugin for Signing -->
192+
<plugin>
193+
<groupId>org.apache.maven.plugins</groupId>
194+
<artifactId>maven-gpg-plugin</artifactId>
195+
<executions>
196+
<execution>
197+
<id>sign-artifacts</id>
198+
<phase>deploy</phase>
199+
<goals>
200+
<goal>sign</goal>
201+
</goals>
202+
</execution>
203+
</executions>
204+
<configuration>
205+
<gpgArguments>
206+
<arg>--pinentry-mode</arg>
207+
<arg>loopback</arg>
208+
</gpgArguments>
209+
</configuration>
210+
</plugin>
211+
<!-- Plugin for Deploying -->
212+
<plugin>
213+
<groupId>org.apache.maven.plugins</groupId>
214+
<artifactId>maven-deploy-plugin</artifactId>
215+
</plugin>
216+
<!-- Plugin for Nexus Staging -->
217+
<plugin>
218+
<groupId>org.sonatype.plugins</groupId>
219+
<artifactId>nexus-staging-maven-plugin</artifactId>
220+
<version>1.7.0</version>
221+
<extensions>true</extensions>
222+
<configuration>
223+
<serverId>ossrh</serverId>
224+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
225+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
226+
</configuration>
227+
</plugin>
179228
<plugin>
180229
<groupId>org.apache.maven.plugins</groupId>
181230
<artifactId>maven-enforcer-plugin</artifactId>
@@ -236,6 +285,23 @@
236285
</snapshotRepository>
237286
</distributionManagement>
238287
</profile>
239-
288+
<profile>
289+
<id>ossrh</id>
290+
<activation>
291+
<activeByDefault>true</activeByDefault>
292+
</activation>
293+
<distributionManagement>
294+
<repository>
295+
<id>ossrh</id>
296+
<name>sonatype</name>
297+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
298+
</repository>
299+
<snapshotRepository>
300+
<id>ossrh</id>
301+
<name>sonatype</name>
302+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
303+
</snapshotRepository>
304+
</distributionManagement>
305+
</profile>
240306
</profiles>
241307
</project>

settings.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@
77
<username>${env.GITHUB_ACTOR}</username>
88
<password>${env.GITHUB_TOKEN}</password>
99
</server>
10+
<server>
11+
<id>ossrh</id>
12+
<username>${env.MAVEN_CENTRAL_USERNAME}</username>
13+
<password>${env.MAVEN_CENTRAL_PASSWORD}</password>
14+
</server>
1015
</servers>
1116
</settings>

0 commit comments

Comments
 (0)