Skip to content

Commit 5675613

Browse files
committed
ci: improve maven workflows and add deployment
- Add descriptive step names in maven-build.yml - Remove redundant comments in maven-build.yml - Add new maven-deploy.yml workflow for Maven Central deployment
1 parent 14d4454 commit 5675613

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

.github/workflows/maven-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- name: Git Checkout
18+
uses: actions/checkout@v4
1819

19-
# Build with JDK 17
2020
- name: Set up JDK 17
2121
uses: actions/setup-java@v4
2222
with:
2323
cache: maven
2424
java-version: '17'
2525
distribution: 'temurin'
26+
2627
- name: Build with Maven
2728
run: mvn -B package --file pom.xml
2829

29-
# Upload coverage reports to Codecov
3030
- name: Upload coverage reports to Codecov
3131
uses: codecov/codecov-action@v5
3232
with:

.github/workflows/maven-deploy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Maven Deploy
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
deploy:
10+
name: maven deploy
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Git Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
cache: maven
21+
java-version: '17'
22+
distribution: 'temurin'
23+
server-id: central # <publishingServerId> in pom.xml
24+
server-username: MAVEN_USERNAME
25+
server-password: MAVEN_PASSWORD
26+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
27+
gpg-passphrase: GPG_PASSPHRASE
28+
29+
- name: Deploy to Maven Central
30+
run: mvn clean deploy -DskipTests -B
31+
env:
32+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
33+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
34+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)