8
8
jobs :
9
9
release :
10
10
runs-on : ubuntu-latest
11
- if : " ! contains(github.event.head_commit.message, '[ci skip]')"
11
+ if : ${{ ! contains(github.event.head_commit.message, '[ci skip]') }}
12
12
13
13
steps :
14
14
- uses : actions/checkout@v3
15
15
with :
16
16
fetch-depth : 2
17
17
18
+ - name : Extract data from pom.xml
19
+ id : pom-data
20
+ uses : andreacomo/maven-gav-extractor@v2
21
+
22
+ - name : Get Changelog Entry based on pom.xml version
23
+ id : changelog_for_pom_version
24
+ uses : mindsers/changelog-reader-action@v2
25
+ with :
26
+ version : ${{ steps.pom-data.outputs.version }}
27
+ validation_level : error
28
+ validation_depth : 5
29
+
30
+ - name : check tag on version
31
+ uses : mukunku/tag-exists-action@v1.1.0
32
+ id : tag-for-pom-version
33
+ with :
34
+ tag : OpenKIM-${{ steps.pom-data.outputs.version }}
35
+ env :
36
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37
+
38
+ - name : cancel action on tag exist
39
+ if : steps.tag-for-pom-version.outputs.exists == 'true'
40
+ run : |
41
+ echo "::error::Tag for version ${{ steps.pom-data.outputs.version }} already exist."
42
+ exit 1
43
+
18
44
- name : Set up JDK 17
19
- uses : actions/setup-java@v2
45
+ uses : actions/setup-java@v3
20
46
with :
21
47
java-version : 17
22
48
distribution : ' zulu'
@@ -28,55 +54,28 @@ jobs:
28
54
git config --global user.name "Release Bot"
29
55
git clone https://github.com/gematik/api-telematik.git
30
56
31
- - name : Extract release notes
32
- id : extract-release-notes
33
- uses : ffurrer2/extract-release-notes@v1
34
-
35
57
- name : Build with Maven
36
58
id : build_maven
37
59
run : |
38
60
mvn -B package --file pom.xml
39
- VERSION=$(mvn --non-recursive help:evaluate -Dexpression=project.version -q -DforceStdout | grep -v '\[.*')
40
- echo "::set-output name=version::$VERSION"
41
-
42
- - uses : mukunku/tag-exists-action@v1.1.0
43
- id : checkTag
44
- with :
45
- tag : OpenKIM-${{ steps.build_maven.outputs.version }}
46
- env :
47
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48
-
49
- - name : Publish new version
50
- if : steps.checkTag.outputs.exists == 'false'
51
- uses : svenstaro/upload-release-action@v2
52
- with :
53
- repo_name : sberg-net/openkim
54
- repo_token : ${{ secrets.GITHUB_TOKEN }}
55
- file : target/openkim-${{ steps.build_maven.outputs.version }}.jar
56
- tag : OpenKIM-${{ steps.build_maven.outputs.version }}
57
- overwrite : false
58
- body : ${{ steps.extract-release-notes.outputs.release_notes }}
59
61
60
62
- name : Docker meta
61
- if : steps.checkTag.outputs.exists == 'false'
62
63
id : meta
63
- uses : docker/metadata-action@v3
64
+ uses : docker/metadata-action@v5
64
65
with :
65
66
images : |
66
- sbergit /openkim
67
+ ${{ secrets.DOCKER_HUB_USER }} /openkim
67
68
tags : |
68
69
type=raw,value=latest
69
- type=match,pattern=[0-9]+.[0-9]+.[0-9]+,value=v${{ steps.build_maven .outputs.version }}
70
- #type=match,pattern=[0-9]+.[0-9]+,value=v${{ steps.build_maven .outputs.version }}
70
+ type=match,pattern=[0-9]+.[0-9]+.[0-9]+,value=v${{ steps.pom-data .outputs.version }}
71
+ #type=match,pattern=[0-9]+.[0-9]+,value=v${{ steps.pom-data .outputs.version }}
71
72
#type=sha
72
73
73
74
- name : Set up Docker Buildx
74
- if : steps.checkTag.outputs.exists == 'false'
75
75
id : buildx
76
- uses : docker/setup-buildx-action@v2
76
+ uses : docker/setup-buildx-action@v3
77
77
78
78
- name : Inspect builder
79
- if : steps.checkTag.outputs.exists == 'false'
80
79
run : |
81
80
echo "Name: ${{ steps.buildx.outputs.name }}"
82
81
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
@@ -86,15 +85,13 @@ jobs:
86
85
echo "Tags: ${{ steps.meta.outputs.tags }}"
87
86
88
87
- name : Login to DockerHub
89
- if : steps.checkTag.outputs.exists == 'false'
90
88
uses : docker/login-action@v3
91
89
with :
92
- username : sbergit
93
- password : ${{ secrets.DOCKER_HUB }}
90
+ username : ${{ secrets.DOCKER_HUB_USER }}
91
+ password : ${{ secrets.DOCKER_HUB_TOKEN }}
94
92
95
- - name : Build and push
96
- if : steps.checkTag.outputs.exists == 'false'
97
- uses : docker/build-push-action@v2
93
+ - name : Build and push docker images
94
+ uses : docker/build-push-action@v5
98
95
with :
99
96
context : .
100
97
file : docker/Dockerfile
@@ -104,3 +101,12 @@ jobs:
104
101
labels : ${{ steps.meta.outputs.labels }}
105
102
cache-from : type=gha
106
103
cache-to : type=gha,mode=max
104
+
105
+ - name : Publish new version
106
+ uses : svenstaro/upload-release-action@v2
107
+ with :
108
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
109
+ file : target/openkim-${{ steps.pom-data.outputs.version }}.jar
110
+ tag : OpenKIM-${{ steps.pom-data.outputs.version }}
111
+ overwrite : false
112
+ body : ${{ steps.changelog_for_pom_version.outputs.changes }}
0 commit comments