-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (86 loc) · 2.49 KB
/
maven-build-and-deploy.yaml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Build, Test & Publish
on:
push:
branches:
- "main"
- "maintenance/*"
tags:
- "redlink-utils-v*"
jobs:
version:
name: Determine Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 2
- name: Set up Java/Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Detect Version
id: version
run: ./mvnw -B -q -N exec:exec -Dexec.executable=echo -Dexec.args='version=${project.version}' >>"$GITHUB_OUTPUT"
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java/Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Compile & Test
run: ./mvnw -V -B --no-transfer-progress
clean package verify
-Psonarcloud
-Dsonar.projectKey=io.redlink.utils:redlink-utils
-Dsonar.skip=${{ github.actor == 'dependabot[bot]' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: '**/TEST-*.xml'
deploy:
name: Publish
needs:
- version
- build
runs-on: ubuntu-latest
if: github.repository == 'redlink-gmbh/redlink-utils'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java/Maven
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish Packages
run: ./mvnw -B --no-transfer-progress
package javadoc:aggregate-jar deploy
-Prelease
-Dquick
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}