-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (69 loc) · 2 KB
/
build.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build and deploy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
name: build java ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
server-id: github
cache: 'maven'
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml
makeversion:
if: github.ref != 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
name: Create version
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Decide on build version
id: version
run: |
if [[ $GITHUB_REF == *"tags"* ]]; then
TAG=${GITHUB_REF#refs/tags/}
else
TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT
fi
echo "version=${TAG//\//-}" >> $GITHUB_OUTPUT
deploy_snapshot:
if: startsWith(github.ref, 'refs/heads/')
needs: makeversion
runs-on: ubuntu-latest
name: Deploy snapshot
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: digipost/[email protected]
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: false
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: makeversion
name: Release to Sonatype
steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
submodules: true
- name: Release to Central Repository
uses: digipost/[email protected]
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: true