-
Notifications
You must be signed in to change notification settings - Fork 12
56 lines (48 loc) · 1.57 KB
/
ci-publish.yml
File metadata and controls
56 lines (48 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: CI & Publish
on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 25 (Azul Zulu)
if: "!startsWith(github.ref, 'refs/tags/v')"
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '25'
cache: maven
- name: Set up JDK 25 (Azul Zulu) for Maven Central
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '25'
cache: maven
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Set release version from tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "Publishing version: $VERSION"
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false
- name: Build and test
if: "!startsWith(github.ref, 'refs/tags/v')"
run: mvn verify
- name: Publish to Maven Central
if: startsWith(github.ref, 'refs/tags/v')
run: mvn -Prelease clean deploy
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}