Skip to content

Commit 13dc044

Browse files
committed
Automatically deploy to Maven Central when creating new GitHub releases
1 parent 8fb7fe1 commit 13dc044

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy to Maven Central
2+
3+
on: [release]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
10+
11+
- name: Set up JDK
12+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
13+
with:
14+
distribution: temurin
15+
java-version: 8
16+
server-id: ossrh
17+
server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
18+
server-password: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
19+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
20+
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
21+
22+
- name: Cache local Maven repository
23+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: |
28+
${{ runner.os }}-maven-
29+
30+
- name: Publish to Apache Maven Central
31+
run: ./mvnw deploy
32+
env:
33+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
34+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@
313313
<plugin>
314314
<groupId>org.apache.maven.plugins</groupId>
315315
<artifactId>maven-gpg-plugin</artifactId>
316+
317+
<configuration>
318+
<gpgArguments>
319+
<arg>--pinentry-mode</arg>
320+
<arg>loopback</arg>
321+
</gpgArguments>
322+
</configuration>
323+
316324
<executions>
317325
<execution>
318326
<id>sign-artifacts</id>

0 commit comments

Comments
 (0)