Skip to content

Commit 217135e

Browse files
committed
CI: split into ci.yml (tests) and publish.yml (release)
1 parent 02fd44a commit 217135e

2 files changed

Lines changed: 30 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: CI
33
on:
44
push:
55
branches: [main]
6-
tags: ['v*']
76
pull_request:
87
branches: [main]
98

@@ -13,44 +12,12 @@ jobs:
1312
runs-on: ubuntu-latest
1413
steps:
1514
- uses: actions/checkout@v6
16-
17-
- name: Set up JDK 8
18-
uses: actions/setup-java@v5
15+
- uses: actions/setup-java@v5
1916
with:
2017
java-version: '8'
2118
distribution: 'temurin'
22-
23-
- name: Cache Maven
24-
uses: actions/cache@v5
19+
- uses: actions/cache@v5
2520
with:
2621
path: ~/.m2/repository
2722
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
28-
29-
- name: Build and Test
30-
run: mvn -B test
31-
32-
publish:
33-
name: Publish to Maven Central
34-
needs: test
35-
if: startsWith(github.ref, 'refs/tags/v')
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/checkout@v6
39-
40-
- name: Set up JDK 8
41-
uses: actions/setup-java@v5
42-
with:
43-
java-version: '8'
44-
distribution: 'temurin'
45-
server-id: central
46-
server-username: CENTRAL_USERNAME
47-
server-password: CENTRAL_PASSWORD
48-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
49-
gpg-passphrase: GPG_PASSPHRASE
50-
51-
- name: Publish
52-
run: mvn -B deploy -DskipTests
53-
env:
54-
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
55-
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
56-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
23+
- run: mvn -B test

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
publish:
9+
name: Publish to Maven Central
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
- uses: actions/setup-java@v5
14+
with:
15+
java-version: '8'
16+
distribution: 'temurin'
17+
server-id: central
18+
server-username: CENTRAL_USERNAME
19+
server-password: CENTRAL_PASSWORD
20+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
21+
gpg-passphrase: GPG_PASSPHRASE
22+
- run: mvn -B test
23+
- run: mvn -B deploy -DskipTests
24+
env:
25+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
26+
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
27+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)