-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (49 loc) · 1.74 KB
/
java-ci.yml
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
name: Java CI
on:
- push
jobs:
build:
name: Java ${{ matrix.java }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
java:
- 8
- 11
- 17
- 21
os:
- ubuntu
- windows
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: ${{ matrix.java }}
java-package: jdk+fx
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build with Gradle
run: ./gradlew build
- name: Deploy to Maven Central
if: matrix.os == 'ubuntu' && matrix.java == 8 && startsWith(github.ref, 'refs/tags/v')
run: |
echo '${{ secrets.SIGNING_KEY }}' | base64 -d > /tmp/signing_key.gpg
./gradlew \
'-PsonatypeUsername=${{ secrets.NEXUS_USERNAME }}' \
'-PsonatypePassword=${{ secrets.NEXUS_PASSWORD }}' \
'-Psigning.keyId=${{ secrets.SIGNING_KEY_ID }}' \
'-Psigning.password=${{ secrets.SIGNING_PASSWORD }}' \
'-Psigning.secretKeyRingFile=/tmp/signing_key.gpg' \
publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Stop Gradle Daemon
run: ./gradlew --stop