Skip to content

Commit 60482c9

Browse files
committed
Add GitHub Actions workflow for Maven Central publishing
1 parent 8097bdd commit 60482c9

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up JDK 8
15+
uses: actions/setup-java@v4
16+
with:
17+
java-version: '8'
18+
distribution: 'temurin'
19+
cache: 'maven'
20+
21+
- name: Import GPG key
22+
uses: crazy-max/ghaction-import-gpg@v6
23+
with:
24+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
25+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
26+
27+
- name: Build and Publish
28+
env:
29+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME_TOKEN }}
30+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD_TOKEN }}
31+
run: |
32+
echo "Starting Maven build and deploy..."
33+
mvn clean deploy -P release \
34+
-Dmaven.javadoc.skip=false \
35+
-Dmaven.deploy.skip=false \
36+
-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} \
37+
-Dmaven.test.failure.ignore=false
38+
39+
echo "Checking deployment status..."
40+
mvn nexus-staging:rc-list
41+
42+
echo "Closing staging repository..."
43+
mvn nexus-staging:rc-close
44+
45+
echo "Releasing to Maven Central..."
46+
mvn nexus-staging:rc-release

0 commit comments

Comments
 (0)