1
- # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2
- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3
-
4
- # This workflow uses actions that are not certified by GitHub.
5
- # They are provided by a third-party and are governed by
6
- # separate terms of service, privacy policy, and support
7
- # documentation.
8
-
9
1
name : Master Build
10
2
11
3
on :
12
4
push :
13
- branches : [ "main" ]
5
+ branches : [ "main", "feature/*" ]
14
6
pull_request :
15
7
branches : [ "main" ]
16
8
@@ -20,84 +12,84 @@ jobs:
20
12
runs-on : ubuntu-latest
21
13
strategy :
22
14
matrix :
23
- version : [17,21,23]
15
+ version : [ 17,21,23 ]
24
16
25
17
steps :
26
- - uses : actions/checkout@v4
27
- - name : Set up JDK ${{ matrix.version }}
28
- uses : actions/setup-java@v4
29
- with :
30
- java-version : ${{ matrix.version }}
31
- distribution : ' temurin'
32
- cache : maven
33
- - name : Build with Maven, Java ${{ matrix.version }}
34
- run : ./mvnw -B verify -Dmaven.compiler.source=${{ matrix.version }} -Dmaven.compiler.target=${{ matrix.version }}
18
+ - uses : actions/checkout@v4
19
+ - name : Set up JDK ${{ matrix.version }}
20
+ uses : actions/setup-java@v4
21
+ with :
22
+ java-version : ${{ matrix.version }}
23
+ distribution : ' temurin'
24
+ cache : maven
25
+ - name : Build with Maven, Java ${{ matrix.version }}
26
+ run : ./mvnw --no-transfer-progress verify -Dmaven.compiler.source=${{ matrix.version }} -Dmaven.compiler.target=${{ matrix.version }}
35
27
36
28
sonar-build :
37
29
needs : build
38
30
runs-on : ubuntu-latest
39
31
40
32
steps :
41
- - uses : actions/checkout@v4
42
- with :
43
- fetch-depth : 0
33
+ - uses : actions/checkout@v4
34
+ with :
35
+ fetch-depth : 0
36
+
37
+ - name : Set up JDK 17 for Sonar-build
38
+ uses : actions/setup-java@v4
39
+ with :
40
+ java-version : ' 17'
41
+ distribution : ' temurin'
42
+ cache : maven
43
+
44
+ - name : Cache SonarCloud packages
45
+ uses : actions/cache@v3
46
+ with :
47
+ path : ~/.sonar/cache
48
+ key : ${{ runner.os }}-sonar
49
+ restore-keys : ${{ runner.os }}-sonar
44
50
45
- - name : Set up JDK 17 for Sonar-build
46
- uses : actions/setup-java@v4
47
- with :
48
- java-version : ' 17'
49
- distribution : ' temurin'
50
- cache : maven
51
+ - uses : radcortez/project-metadata-action@master
52
+ name : Retrieve project metadata from '.github/project.yml'
53
+ id : metadata
54
+ with :
55
+ github-token : ${{secrets.GITHUB_TOKEN}}
56
+ metadata-file-path : ' .github/project.yml'
57
+ local-file : true
51
58
52
- - name : Cache SonarCloud packages
53
- uses : actions/cache@v3
54
- with :
55
- path : ~/.sonar/cache
56
- key : ${{ runner.os }}-sonar
57
- restore-keys : ${{ runner.os }}-sonar
58
-
59
- - uses : radcortez/project-metadata-action@1.1
60
- name : Retrieve project metadata from '.github/project.yml'
61
- id : metadata
62
- with :
63
- github-token : ${{secrets.GITHUB_TOKEN}}
64
- metadata-file-path : ' .github/project.yml'
65
- local-file : true
66
-
67
- - name : Build and analyze
68
- env :
69
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
70
- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
71
- run : ./mvnw -B verify -Psonar -Dsonar.projectKey=${{steps.metadata.outputs.sonar-project-key}} sonar:sonar
59
+ - name : Build and analyze
60
+ env :
61
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
62
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
63
+ run : ./mvnw -B verify -Psonar -Dsonar.projectKey=${{steps.metadata.outputs.sonar-project-key}} sonar:sonar
72
64
73
65
deploy-snapshot :
74
66
needs : sonar-build
75
- if : github.event_name != 'pull_request '
67
+ if : github.ref == 'refs/heads/main '
76
68
runs-on : ubuntu-latest
77
69
steps :
78
- - uses : actions/checkout@v4
79
- - name : Set up JDK 17 for snapshot release
80
- uses : actions/setup-java@v4
81
- with :
82
- java-version : ' 17'
83
- distribution : ' temurin'
84
- server-id : sonatype-nexus-snapshots
85
- server-username : MAVEN_USERNAME
86
- server-password : MAVEN_CENTRAL_TOKEN
87
- gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
88
- gpg-passphrase : MAVEN_GPG_PASSPHRASE
89
- cache : maven
70
+ - uses : actions/checkout@v4
71
+ - name : Set up JDK 17 for snapshot release
72
+ uses : actions/setup-java@v4
73
+ with :
74
+ java-version : ' 17'
75
+ distribution : ' temurin'
76
+ server-id : sonatype-nexus-snapshots
77
+ server-username : MAVEN_USERNAME
78
+ server-password : MAVEN_CENTRAL_TOKEN
79
+ gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
80
+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
81
+ cache : maven
90
82
91
- - name : Extract project version
92
- id : project
93
- run : echo ::set-output name=version::$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
83
+ - name : Extract project version
84
+ id : project
85
+ run : echo ::set-output name=version::$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
94
86
95
- - name : Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
96
- if : ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
97
- run : |
98
- ./mvnw -B -Prelease-snapshot javadoc:aggregate
99
- ./mvnw -B -Prelease-snapshot deploy -Dmaven.test.skip=true
100
- env :
101
- MAVEN_USERNAME : ${{ secrets.OSS_SONATYPE_USERNAME }}
102
- MAVEN_CENTRAL_TOKEN : ${{ secrets.OSS_SONATYPE_PASSWORD }}
103
- MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
87
+ - name : Deploy Snapshot with Maven, version ${{ steps.project.outputs.version }}
88
+ if : ${{endsWith(steps.project.outputs.version, '-SNAPSHOT')}}
89
+ run : |
90
+ ./mvnw -B -Prelease-snapshot javadoc:aggregate
91
+ ./mvnw -B -Prelease-snapshot deploy -Dmaven.test.skip=true
92
+ env :
93
+ MAVEN_USERNAME : ${{ secrets.OSS_SONATYPE_USERNAME }}
94
+ MAVEN_CENTRAL_TOKEN : ${{ secrets.OSS_SONATYPE_PASSWORD }}
95
+ MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
0 commit comments