11#
2- # Copyright © 2018 - Frank Hossfeld
2+ # Copyright © 2023 Frank Hossfeld, Philipp Kohl
33#
4- # Licensed under the Apache License, Version 2.0 (the "License");
5- # you may not use this file except in compliance with the License.
6- # You may obtain a copy of the License at
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
77#
8- # http://www.apache.org/licenses/LICENSE-2.0
8+ # http://www.apache.org/licenses/LICENSE-2.0
99#
10- # Unless required by applicable law or agreed to in writing, software
11- # distributed under the License is distributed on an "AS IS" BASIS,
12- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- # See the License for the specific language governing permissions and
14- # limitations under the License.
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
1515#
16+
1617name : Build & Deploy
1718
1819on :
2324 paths-ignore :
2425 - " README.md"
2526jobs :
26- build-jdk11 :
27+ build :
2728 runs-on : ubuntu-latest
2829 steps :
2930 - uses : actions/checkout@v4
@@ -33,52 +34,11 @@ jobs:
3334 java-version : ' 11'
3435 cache : maven
3536 - name : Compile with Maven
36- run : mvn compile -ntp
37- build-jdk17 :
38- runs-on : ubuntu-latest
39- steps :
40- - uses : actions/checkout@v4
41- - uses : actions/setup-java@v4
42- with :
43- distribution : temurin
44- java-version : ' 17'
45- cache : maven
46- - name : Compile with Maven
47- run : mvn compile -ntp
48- build-jdk21 :
49- runs-on : ubuntu-latest
50- steps :
51- - uses : actions/checkout@v4
52- - uses : actions/setup-java@v4
53- with :
54- distribution : temurin
55- java-version : ' 21'
56- cache : maven
57- - name : Compile with Maven
58- run : mvn compile -ntp
59-
60- check-versions :
61- runs-on : ubuntu-latest
62- needs : [ build-jdk11, build-jdk17, build-jdk21 ]
63- timeout-minutes : 8
64- steps :
65- - uses : actions/checkout@v4
66- - uses : actions/setup-java@v4
67- with :
68- distribution : temurin
69- java-version : ' 11'
70- cache : maven
71- - uses : actions/setup-java@v4
72- with :
73- distribution : temurin
74- java-version : ' 17'
75- cache : maven
76- - name : Check versions with Maven
77- run : mvn versions:display-dependency-updates -ntp
37+ run : mvn compile -ntp -P build
7838
79- test-jdk11 :
39+ test :
8040 runs-on : ubuntu-latest
81- needs : [ build-jdk11 ]
41+ needs : build
8242 steps :
8343 - uses : actions/checkout@v4
8444 - uses : actions/setup-java@v4
@@ -87,55 +47,20 @@ jobs:
8747 java-version : ' 11'
8848 cache : maven
8949 - name : Test with Maven
90- run : mvn test -ntp
91- - uses : actions/upload-artifact@v4
92- if : failure()
93- with :
94- name : surefire-report
95- path : target/surefire-reports/
96- test-jdk17 :
97- runs-on : ubuntu-latest
98- needs : [ build-jdk17 ]
99- steps :
100- - uses : actions/checkout@v4
101- - uses : actions/setup-java@v4
102- with :
103- distribution : temurin
104- java-version : ' 17'
105- cache : maven
106- - name : Test with Maven
107- run : mvn test -ntp
108- - uses : actions/upload-artifact@v4
109- if : failure()
110- with :
111- name : surefire-report
112- path : target/surefire-reports/
113- test-jdk21 :
114- runs-on : ubuntu-latest
115- needs : [ build-jdk21 ]
116- steps :
117- - uses : actions/checkout@v4
118- - uses : actions/setup-java@v4
119- with :
120- distribution : temurin
121- java-version : ' 21'
122- cache : maven
123- - name : Test with Maven
124- run : mvn test -ntp
50+ run : mvn test -ntp -P development
12551 - uses : actions/upload-artifact@v4
12652 if : failure()
12753 with :
12854 name : surefire-report
12955 path : target/surefire-reports/
13056
131- owasp :
57+ build-and- owasp :
13258 runs-on : ubuntu-latest
133- timeout-minutes : 8
13459 permissions :
13560 actions : read
13661 contents : read
13762 security-events : write
138- needs : [ build-jdk11, build-jdk17, build-jdk21 ]
63+ needs : test
13964 services :
14065 owasp-db :
14166 image : nalusolutionsgmbh/owasp-maven-action:latest
14772 distribution : temurin
14873 java-version : ' 11'
14974 cache : maven
75+ - name : Build with Maven
76+ run : mvn install -ntp -P development
15077 - name : Copy owasp database from container to runner
15178 run : docker cp $(docker ps -aqf "name=owasp-db"):/dependency-check/data ./dependency-checker-db/
15279 - name : OWASP Check
16794
16895 maven-deploy-dev :
16996 runs-on : ubuntu-latest
170- needs : [ check-versions, test-jdk11, test-jdk17, test-jdk21, owasp ]
97+ needs : build-and- owasp
17198 if : github.ref == 'refs/heads/dev'
17299 steps :
173100 - uses : actions/checkout@v4
@@ -176,7 +103,7 @@ jobs:
176103 distribution : temurin
177104 java-version : ' 11'
178105 cache : maven
179- server-id : ossrh
106+ server-id : central
180107 server-username : MAVEN_USERNAME
181108 server-password : MAVEN_PASSWORD
182109 - name : Extract Maven project version
@@ -199,13 +126,13 @@ jobs:
199126 gpg --list-secret-keys --keyid-format LONG
200127 - name : Deploy with Maven
201128 env :
202- MAVEN_USERNAME : ${{ secrets.OSSRH_USERNAME }}
203- MAVEN_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
204- run : mvn deploy -ntp -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD_NALUKIT_GITHUB_USER }} -DskipTests -Drevision=HEAD-SNAPSHOT
129+ MAVEN_USERNAME : ${{ secrets.CENTRAL_TOKEN_USERNAME }}
130+ MAVEN_PASSWORD : ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
131+ run : mvn deploy -ntp -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD_NALUKIT_GITHUB_USER }} -DskipTests -Drevision=HEAD-SNAPSHOT -P release
205132
206133 maven-deploy-main :
207134 runs-on : ubuntu-latest
208- needs : [ check-versions, test-jdk11, test-jdk17, test-jdk21, owasp ]
135+ needs : build-and- owasp
209136 if : github.ref == 'refs/heads/main'
210137 steps :
211138 - uses : actions/checkout@v4
@@ -214,7 +141,7 @@ jobs:
214141 distribution : temurin
215142 java-version : ' 11'
216143 cache : maven
217- server-id : ossrh
144+ server-id : central
218145 server-username : MAVEN_USERNAME
219146 server-password : MAVEN_PASSWORD
220147 - name : Extract Maven project version
@@ -258,7 +185,7 @@ jobs:
258185 gpg --list-secret-keys --keyid-format LONG
259186 - name : Deploy with Maven
260187 env :
261- MAVEN_USERNAME : ${{ secrets.OSSRH_USERNAME }}
262- MAVEN_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
263- run : mvn deploy -ntp -P release - Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD_NALUKIT_GITHUB_USER }} -DskipTests -Daether.checksums.algorithms=MD5 -Drevision=${{ steps.project.outputs.version }}
188+ MAVEN_USERNAME : ${{ secrets.CENTRAL_TOKEN_USERNAME }}
189+ MAVEN_PASSWORD : ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
190+ run : mvn deploy -ntp -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD_NALUKIT_GITHUB_USER }} -DskipTests -Daether.checksums.algorithms=MD5 -Drevision=${{ steps.project.outputs.version }} -P release
264191
0 commit comments