1
- name : Build snapshot
1
+ name : Build and deploy
2
2
3
3
on : [push]
4
4
5
5
jobs :
6
6
build :
7
-
8
7
runs-on : ubuntu-latest
9
-
10
8
strategy :
11
9
matrix :
12
10
java : [ '1.8', '11' ]
@@ -21,17 +19,49 @@ jobs:
21
19
- name : Build with Maven
22
20
run : mvn -B package --no-transfer-progress --file pom.xml
23
21
24
- deploy :
22
+ makeversion :
23
+ if : github.ref != 'refs/heads/main'
24
+ needs : build
25
25
runs-on : ubuntu-latest
26
-
27
- name : deploy snapshot
26
+ name : Create version
27
+ outputs :
28
+ version : ${{ steps.version.outputs.version }}
29
+ steps :
30
+ - name : Decide on build version
31
+ id : version
32
+ run : |
33
+ if [[ $GITHUB_REF == *"tags"* ]]; then
34
+ TAG=${GITHUB_REF#refs/tags/}
35
+ else
36
+ TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT
37
+ fi
38
+ echo ::set-output name=version::${TAG//\//-}
39
+
40
+ deploy_snapshot :
41
+ if : startsWith(github.ref, 'refs/heads/')
42
+ needs : makeversion
43
+ runs-on : ubuntu-latest
44
+
45
+ name : Deploy snapshot
28
46
steps :
29
47
- uses : actions/checkout@v1
30
- - name : Set release version
31
- run : echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:11}"-SNAPSHOT")
32
- - name : Build and deploy to Sonatype snapshot
33
-
48
+ -
uses :
digipost/[email protected]
34
49
with :
35
50
sonatype_secrets : ${{ secrets.sonatype_secrets }}
36
- release_version : ${{ env.RELEASE_VERSION }}
51
+ release_version : ${{ needs.makeversion.outputs.version }}
37
52
perform_release : false
53
+
54
+ release :
55
+ if : startsWith(github.ref, 'refs/tags/')
56
+ runs-on : ubuntu-latest
57
+ needs : makeversion
58
+ name : Release to Sonatype
59
+ steps :
60
+ - name : Check out Git repository
61
+ uses : actions/checkout@v1
62
+ - name : Release to Central Repository
63
+
64
+ with :
65
+ sonatype_secrets : ${{ secrets.sonatype_secrets }}
66
+ release_version : ${{ needs.makeversion.outputs.version }}
67
+ perform_release : true
0 commit comments