@@ -13,25 +13,36 @@ jobs:
13
13
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN : ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }}
14
14
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE : ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}
15
15
GITHUB_TOKEN : ${{ github.token }}
16
+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
16
17
MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR : true
17
18
steps :
18
- - name : Checkout
19
+ - name : 📄 Checkout the repository
19
20
uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
21
+ with :
22
+ fetch-depth : 0
20
23
- name : Set up JDK and Maven
21
- uses : actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4
24
+ uses : actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4
22
25
with :
23
26
distribution : adopt
24
27
java-version : 17
25
28
gpg-private-key : ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
26
- - name : Prepare Cache
29
+ - name : 📝 Get the project version
30
+ id : project_version
31
+ run : echo "project_version=$(mvn help:evaluate -Dexpression=project.version
32
+ -q -DforceStdout)" >> $GITHUB_OUTPUT
33
+ - name : 📝 Store cache key
34
+ id : cache_key
35
+ run : echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}-${{
36
+ github.sha }}" >> $GITHUB_OUTPUT
37
+ - name : 💾 Prepare cache using cache key
27
38
id : prepare-cache
28
39
uses : actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
29
40
with :
30
41
path : |
31
42
/home/runner/.m2
32
43
/home/runner/work
33
- key : ${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}
34
- - name : Generate settings.xml
44
+ key : ${{ steps.cache_key.outputs.cache_key }}
45
+ - name : 🔘 Generate settings.xml for Maven
35
46
uses : whelk-io/maven-settings-xml-action@9dc09b23833fa9aa7f27b63db287951856f3433d # v22
36
47
with :
37
48
repositories : >
@@ -78,23 +89,15 @@ jobs:
78
89
}
79
90
}
80
91
]
81
- - name : Print settings.xml
92
+ - name : 🔘 Print settings.xml
82
93
run : cat /home/runner/.m2/settings.xml
83
- - name : Build with Maven
84
- run : mvn --batch-mode clean package
85
- - name : Store project version
86
- id : project_version
87
- run : echo "project_version=$(mvn help:evaluate -Dexpression=project.version
88
- -q -DforceStdout)" >> $GITHUB_OUTPUT
89
- - name : Store cache key
90
- id : cache_key
91
- run : echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}"
92
- >> $GITHUB_OUTPUT
94
+ - name : 📦 Build with Maven
95
+ run : mvn --batch-mode clean package # sonar:sonar
93
96
outputs :
94
97
project_version : ${{ steps.project_version.outputs.project_version }}
95
98
cache_key : ${{ steps.cache_key.outputs.cache_key }}
96
99
97
- # deploy to Maven Central
100
+ # Deploy release to Maven Central
98
101
deploy-maven-central :
99
102
needs : build
100
103
runs-on : ubuntu-latest
@@ -106,21 +109,21 @@ jobs:
106
109
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN : ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }}
107
110
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE : ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}
108
111
steps :
109
- - name : Set up JDK and Maven
110
- uses : actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4
112
+ - name : 🧱 Set up JDK and Maven
113
+ uses : actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4
111
114
with :
112
115
distribution : adopt
113
116
java-version : 17
114
117
gpg-private-key : ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
115
- - name : Restore Cache
118
+ - name : 💾 Restore cache using cache key
116
119
id : restore-cache
117
120
uses : actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
118
121
with :
119
122
path : |
120
123
/home/runner/.m2
121
124
/home/runner/work
122
125
key : ${{ needs.build.outputs.cache_key }}
123
- - name : Publish to Maven Central
126
+ - name : 📦 Deploy artifacts to Maven Central
124
127
run : mvn --batch-mode -Dmaven.test.skip=true deploy -P gpg-sign -P nexus-staging
125
128
126
129
# deploy to GitHub Packages
@@ -136,23 +139,22 @@ jobs:
136
139
S3_SBB_POLARION_MAVEN_REPO_RW_SECRET_ACCESS_KEY : ${{ secrets.S3_SBB_POLARION_MAVEN_REPO_RW_SECRET_ACCESS_KEY }}
137
140
GITHUB_TOKEN : ${{ github.token }}
138
141
steps :
139
- - name : Set up JDK and Maven
140
- uses : actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4
142
+ - name : 🧱 Set up JDK and Maven
143
+ uses : actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4
141
144
with :
142
145
distribution : adopt
143
146
java-version : 17
144
- - name : Cache
145
- id : cache
147
+ - name : 💾 Restore cache using cache key
148
+ id : restore- cache
146
149
uses : actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
147
150
with :
148
151
path : |
149
152
/home/runner/.m2
150
153
/home/runner/work
151
154
key : ${{ needs.build.outputs.cache_key }}
152
- - name : Publish to GitHub Packages
155
+ - name : 📦 Deploy artifacts to GitHub Packages
153
156
run : mvn --batch-mode -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
154
157
deploy -P deploy-github-packages
155
- - name : Upload assets
156
- run : cd ${{github.workspace}} && gh release upload v${{ needs.build.outputs.project_version }}
157
- target/*-${{ needs.build.outputs.project_version }}.jar
158
- shell : bash
158
+ - name : 📦 Upload assets to GitHub Release
159
+ run : |-
160
+ gh release upload v${{ needs.build.outputs.project_version }} target/*-${{ needs.build.outputs.project_version }}.jar
0 commit comments