-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (51 loc) · 1.6 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
name: Build and deploy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '17', '21' ]
name: build java ${{ matrix.java }}
env:
MAVEN_ARGS: --show-version --no-transfer-progress
steps:
- uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven
- name: Build with Maven
run: mvn verify
publishing_parameters:
name: Publishing parameters
runs-on: ubuntu-latest
outputs:
is_release: ${{ steps.version.outputs.is_release }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Determine version
id: version
run: |
if [[ $GITHUB_REF == *"tags"* ]]; then
is_release=true
version=${GITHUB_REF#refs/tags/}
else
is_release=false
version=${GITHUB_REF#refs/heads/}-SNAPSHOT
fi
echo "is_release=${is_release//\//-}" >> $GITHUB_OUTPUT
echo "version=${version//\//-}" >> $GITHUB_OUTPUT
publish:
needs: [build, publishing_parameters]
name: Publish ${{ needs.publishing_parameters.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: digipost/action-maven-publish@v1
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.publishing_parameters.outputs.version }}
perform_release: ${{ needs.publishing_parameters.outputs.is_release }}