Skip to content

Commit 7bd7c80

Browse files
committed
Automatically deploy to Maven Central when creating new GitHub releases
1 parent 7f3be32 commit 7bd7c80

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
10+
11+
- name: Set up JDK
12+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
13+
with:
14+
distribution: temurin
15+
java-version: 8
16+
server-id: central
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@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
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 -DperformRelease=true
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 }}

0 commit comments

Comments
 (0)