Skip to content

Commit ff287a5

Browse files
committed
Add maven central release GH Action workflow
1 parent 6c5df08 commit ff287a5

File tree

3 files changed

+93
-1
lines changed

3 files changed

+93
-1
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release to Maven Central
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
description: "Release version"
8+
required: true
9+
10+
jobs:
11+
build:
12+
name: Release project
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
17+
- name: Check out sources
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v3
22+
with:
23+
distribution: 'temurin'
24+
java-version: 17
25+
cache: 'maven'
26+
27+
- name: Install GPG key
28+
run: |
29+
echo "${{ secrets.GPG_PRIVATE_KEY }}" > gpg.asc
30+
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --import gpg.asc
31+
32+
- name: Release to Sonatype OSSRH
33+
env:
34+
SONATYPE_USER: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
35+
SONATYPE_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
36+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
37+
run: |
38+
./mvnw -B clean install -DskipTests
39+
./mvnw -B clean deploy -Psonatype -s settings.xml
40+
41+
- name: Setup Graphviz
42+
uses: ts-graphviz/setup-graphviz@v1
43+
44+
- name: Deploy documentation
45+
env:
46+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
47+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
48+
run: ./mvnw -B clean deploy -Pdocumentation

pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,44 @@
794794
</repository>
795795
</distributionManagement>
796796
</profile>
797+
<profile>
798+
<id>sonatype</id>
799+
<properties>
800+
<maven.test.skip>true</maven.test.skip>
801+
</properties>
802+
<build>
803+
<plugins>
804+
<plugin>
805+
<groupId>org.apache.maven.plugins</groupId>
806+
<artifactId>maven-gpg-plugin</artifactId>
807+
<executions>
808+
<execution>
809+
<id>sign-artifacts</id>
810+
<phase>verify</phase>
811+
<goals>
812+
<goal>sign</goal>
813+
</goals>
814+
</execution>
815+
</executions>
816+
<configuration>
817+
<!-- Passphrase consumed from MAVEN_GPG_PASSPHRASE environment variable. -->
818+
</configuration>
819+
</plugin>
820+
<plugin>
821+
<groupId>org.sonatype.plugins</groupId>
822+
<artifactId>nexus-staging-maven-plugin</artifactId>
823+
<version>1.7.0</version>
824+
<extensions>true</extensions>
825+
<configuration>
826+
<serverId>sonatype-new</serverId>
827+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
828+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
829+
<keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
830+
</configuration>
831+
</plugin>
832+
</plugins>
833+
</build>
834+
</profile>
797835
</profiles>
798836

799837
<dependencyManagement>

settings.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
<username>${env.ARTIFACTORY_USERNAME}</username>
3636
<password>${env.ARTIFACTORY_PASSWORD}</password>
3737
</server>
38+
39+
<server>
40+
<id>sonatype-new</id>
41+
<username>${env.SONATYPE_USER}</username>
42+
<password>${env.SONATYPE_PASSWORD}</password>
43+
</server>
3844
</servers>
3945

40-
</settings>
46+
</settings>

0 commit comments

Comments
 (0)