Skip to content

Commit 84b8fe7

Browse files
committed
feat: Adding maven central deployment
1 parent 2521870 commit 84b8fe7

File tree

2 files changed

+111
-58
lines changed

2 files changed

+111
-58
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ jobs:
5656
distribution: "temurin" # As good as any other, see: https://github.com/actions/setup-java#supported-distributions
5757
java-package: "jdk"
5858
java-version: "21"
59+
gpg-private-key: ${{ secrets.OSS_SONATYPE_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
60+
gpg-passphrase: ${{ secrets.OSS_SONATYPE_GPG_PASSPHRASE }} # env variable for GPG private key passphrase
5961
check-latest: true
6062
cache: "maven"
6163

@@ -67,7 +69,7 @@ jobs:
6769
[{
6870
"id": "central",
6971
"username": "${{ secrets.OSS_SONATYPE_USER }}",
70-
"password": "${{ secrets.OSS_SONATYPE_USER }}"
72+
"password": "${{ secrets.OSS_SONATYPE_PASS }}"
7173
},{
7274
"id":"github",
7375
"username": "ci-bot",
@@ -79,7 +81,7 @@ jobs:
7981
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
8082
run: |
8183
export TZ="Europe/Berlin"
82-
mvn release:prepare release:perform -B -DreleaseVersion=${{ inputs.releaseversion }} -DskipITs=true -Darguments="-DskipTests=true -DskipITs=true"
84+
mvn release:prepare release:perform -B -Pcentral-publish -DreleaseVersion=${{ inputs.releaseversion }} -DskipITs=true -Darguments="-DskipTests=true -DskipITs=true"
8385
# write version info
8486
cat <<EOF >target/config.json
8587
{

pom.xml

Lines changed: 107 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34

45
<groupId>net.continuous-security-tools</groupId>
@@ -40,13 +41,14 @@
4041
</prerequisites>
4142

4243
<distributionManagement>
43-
<repository>
44-
<id>github</id>
45-
<name>GitHub Packages</name>
46-
<url>https://maven.pkg.github.com/ContinuousSecurityTooling/keycloak-auditor</url>
47-
</repository>
44+
<repository>
45+
<id>github</id>
46+
<name>GitHub Packages</name>
47+
<url>https://maven.pkg.github.com/ContinuousSecurityTooling/keycloak-auditor</url>
48+
</repository>
4849
</distributionManagement>
4950

51+
5052
<issueManagement>
5153
<url>https://github.com/ContinuousSecurityTooling/keycloak-auditor/issues</url>
5254
<system>GitHub Issues</system>
@@ -63,7 +65,7 @@
6365
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6466
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
6567
<encoding>UTF-8</encoding>
66-
<surefire.argLine />
68+
<surefire.argLine/>
6769

6870
<java.version>17</java.version>
6971

@@ -72,7 +74,7 @@
7274
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
7375
<!-- Point the Sonar Qube Plugin always to the same aggregated JaCoCo report -->
7476
<sonar.coverage.jacoco.xmlReportPaths>
75-
${project.basedir}/../spi/target/site/jacoco/jacoco.xml
77+
${project.basedir}/../spi/target/site/jacoco/jacoco.xml
7678
</sonar.coverage.jacoco.xmlReportPaths>
7779

7880
<!-- logging dependencies -->
@@ -109,6 +111,8 @@
109111
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
110112
<plugin.gitflow-maven.version>1.21.0</plugin.gitflow-maven.version>
111113
<typescript-generator-maven-plugin.version>3.2.1263</typescript-generator-maven-plugin.version>
114+
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
115+
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
112116

113117
</properties>
114118

@@ -194,10 +198,10 @@
194198
<scope>test</scope>
195199
</dependency>
196200
<dependency>
197-
<groupId>org.mockito</groupId>
198-
<artifactId>mockito-junit-jupiter</artifactId>
199-
<version>${mockito.version}</version>
200-
<scope>test</scope>
201+
<groupId>org.mockito</groupId>
202+
<artifactId>mockito-junit-jupiter</artifactId>
203+
<version>${mockito.version}</version>
204+
<scope>test</scope>
201205
</dependency>
202206
<dependency>
203207
<groupId>org.hamcrest</groupId>
@@ -238,14 +242,14 @@
238242
<artifactId>mockito-core</artifactId>
239243
</dependency>
240244
<dependency>
241-
<groupId>org.mockito</groupId>
242-
<artifactId>mockito-junit-jupiter</artifactId>
245+
<groupId>org.mockito</groupId>
246+
<artifactId>mockito-junit-jupiter</artifactId>
243247
</dependency>
244248
<dependency>
245-
<groupId>org.junit-pioneer</groupId>
246-
<artifactId>junit-pioneer</artifactId>
247-
<version>2.2.0</version>
248-
<scope>test</scope>
249+
<groupId>org.junit-pioneer</groupId>
250+
<artifactId>junit-pioneer</artifactId>
251+
<version>2.2.0</version>
252+
<scope>test</scope>
249253
</dependency>
250254
</dependencies>
251255

@@ -270,7 +274,8 @@
270274
<threadCount>1</threadCount>
271275
<perCoreThreadCount>false</perCoreThreadCount>
272276
<argLine>
273-
@{surefire.argLine} --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED
277+
@{surefire.argLine} --add-opens java.base/java.util=ALL-UNNAMED --add-opens
278+
java.base/java.lang=ALL-UNNAMED
274279
</argLine>
275280
</configuration>
276281
</plugin>
@@ -298,9 +303,9 @@
298303
<onlyWhenRelease>true</onlyWhenRelease>
299304
</requireReleaseDeps>
300305

301-
<banDuplicatePomDependencyVersions />
306+
<banDuplicatePomDependencyVersions/>
302307

303-
<dependencyConvergence />
308+
<dependencyConvergence/>
304309
</rules>
305310
</configuration>
306311
</plugin>
@@ -310,43 +315,89 @@
310315
<artifactId>versions-maven-plugin</artifactId>
311316
<version>${maven-versions-plugin.version}</version>
312317
</plugin>
313-
<!-- Coverage metering -->
314-
<plugin>
315-
<groupId>org.jacoco</groupId>
316-
<artifactId>jacoco-maven-plugin</artifactId>
317-
<version>${jacoco.version}</version>
318-
<executions>
319-
<execution>
320-
<goals>
321-
<goal>prepare-agent</goal>
322-
</goals>
323-
<configuration>
324-
<propertyName>surefire.argLine</propertyName>
325-
</configuration>
326-
</execution>
327-
<!-- attached to Maven test phase -->
328-
<execution>
329-
<id>report</id>
330-
<phase>test</phase>
331-
<goals>
332-
<goal>report</goal>
333-
</goals>
334-
<configuration>
335-
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
336-
</configuration>
337-
</execution>
338-
</executions>
339-
</plugin>
340-
318+
<!-- Coverage metering -->
341319
<plugin>
342-
<artifactId>maven-release-plugin</artifactId>
343-
<version>3.1.1</version>
344-
<configuration>
345-
<tagNameFormat>v@{project.version}</tagNameFormat>
346-
</configuration>
320+
<groupId>org.jacoco</groupId>
321+
<artifactId>jacoco-maven-plugin</artifactId>
322+
<version>${jacoco.version}</version>
323+
<executions>
324+
<execution>
325+
<goals>
326+
<goal>prepare-agent</goal>
327+
</goals>
328+
<configuration>
329+
<propertyName>surefire.argLine</propertyName>
330+
</configuration>
331+
</execution>
332+
<!-- attached to Maven test phase -->
333+
<execution>
334+
<id>report</id>
335+
<phase>test</phase>
336+
<goals>
337+
<goal>report</goal>
338+
</goals>
339+
<configuration>
340+
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
341+
</configuration>
342+
</execution>
343+
</executions>
347344
</plugin>
348345
</plugins>
349-
350346
</build>
351-
347+
<profiles>
348+
349+
<profile>
350+
<id>central-publish</id>
351+
352+
<distributionManagement>
353+
<snapshotRepository>
354+
<id>ossrh</id>
355+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
356+
</snapshotRepository>
357+
<repository>
358+
<id>ossrh</id>
359+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
360+
</repository>
361+
</distributionManagement>
362+
<build>
363+
<plugins>
364+
<plugin>
365+
<artifactId>maven-release-plugin</artifactId>
366+
<version>3.1.1</version>
367+
<configuration>
368+
<tagNameFormat>v@{project.version}</tagNameFormat>
369+
</configuration>
370+
</plugin>
371+
<plugin>
372+
<groupId>org.apache.maven.plugins</groupId>
373+
<artifactId>maven-gpg-plugin</artifactId>
374+
<version>${maven-gpg-plugin.version}</version>
375+
<executions>
376+
<execution>
377+
<id>sign-artifacts</id>
378+
<phase>verify</phase>
379+
<goals>
380+
<goal>sign</goal>
381+
</goals>
382+
<configuration>
383+
<signer>bc</signer>
384+
</configuration>
385+
</execution>
386+
</executions>
387+
</plugin>
388+
<plugin>
389+
<groupId>org.sonatype.plugins</groupId>
390+
<artifactId>nexus-staging-maven-plugin</artifactId>
391+
<version>${nexus-staging-maven-plugin.version}</version>
392+
<extensions>true</extensions>
393+
<configuration>
394+
<serverId>ossrh</serverId>
395+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
396+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
397+
</configuration>
398+
</plugin>
399+
</plugins>
400+
</build>
401+
</profile>
402+
</profiles>
352403
</project>

0 commit comments

Comments
 (0)