Skip to content

Commit 2d52be8

Browse files
authored
Merge pull request #114 from Mastercard/cormacdalton-publish
Create maven-publish.yml
2 parents 20a5b88 + 7e02283 commit 2d52be8

File tree

2 files changed

+45
-7
lines changed

2 files changed

+45
-7
lines changed

.github/workflows/maven-publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Maven Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '11'
21+
distribution: 'temurin'
22+
server-id: central
23+
server-username: MAVEN_CENTRAL_USERNAME
24+
server-password: MAVEN_CENTRAL_TOKEN
25+
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
26+
gpg-passphrase: GPG_PASSPHRASE
27+
28+
- name: Build and Test
29+
run: mvn clean package -Dmaven.javadoc.skip=false
30+
31+
- name: Publish to Maven Central
32+
env:
33+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
34+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
35+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
36+
run: mvn -X deploy -Dmaven.javadoc.skip=false

pom.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@
4040
</license>
4141
</licenses>
4242

43-
<distributionManagement>
44-
<repository>
45-
<id>ossrh</id>
46-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
47-
</repository>
48-
</distributionManagement>
49-
5043
<dependencies>
5144
<dependency>
5245
<groupId>com.jayway.jsonpath</groupId>
@@ -266,6 +259,15 @@
266259
</execution>
267260
</executions>
268261
</plugin>
262+
<plugin>
263+
<groupId>org.sonatype.central</groupId>
264+
<artifactId>central-publishing-maven-plugin</artifactId>
265+
<version>0.7.0</version>
266+
<extensions>true</extensions>
267+
<configuration>
268+
<publishingServerId>central</publishingServerId>
269+
</configuration>
270+
</plugin>
269271
</plugins>
270272
</build>
271273
</project>

0 commit comments

Comments
 (0)