-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·60 lines (48 loc) · 1.54 KB
/
ci_cd.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
52
53
54
55
56
57
58
59
60
name: Java CI with Gradle
env:
CI: true
on:
push:
branches: [ "**" ]
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.1.0
- name: Compile & Test
run: ./gradlew test
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: '**/build/test-results/**/*.xml'
- name: Containerize
run: ./gradlew jib -Djib.console='plain'
env:
DOCKER_USR: ${{ secrets.DOCKER_USR }}
DOCKER_PSW: ${{ secrets.DOCKER_PSW }}
- name: Generate package
run: ./gradlew publish
# todo separate job ?
- name: Deploy released package in MavenCentral
if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/')
run: ./gradlew jreleaserDeploy
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GNUPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GNUPG_PRIVATE_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}