6
6
description : ' Version number of the release'
7
7
required : true
8
8
jobs :
9
- build :
9
+ check-preconditions :
10
+ name : Check preconditions
10
11
runs-on : ubuntu-20.04
11
12
steps :
12
13
- name : Checkout
13
-
14
- with :
15
- ref : main
16
- fetch-depth : 0
14
+ uses : actions/checkout@v3
15
+
16
+ # Required for Maven
17
17
- name : Set up JDK 17
18
18
uses : actions/setup-java@v2
19
19
with :
20
20
distribution : ' temurin'
21
21
java-version : ' 17'
22
- server-id : ossrh
23
- server-username : OSSRH_USERNAME
24
- server-password : OSSRH_TOKEN
25
- gpg-private-key : ${{ secrets.PGP_KEY }}
26
- gpg-passphrase : PGP_KEY_PASSWORD
27
22
overwrite-settings : false
23
+
28
24
- name : Setup Git
29
25
run : |
30
26
git config user.name github-actions
31
27
git config user.email [email protected]
28
+
32
29
- name : Sanity check version
33
30
if : ${{ !contains( github.event.inputs.release_version, '-M' ) }}
34
31
run : |
@@ -42,75 +39,225 @@ jobs:
42
39
echo release version $release_version is invalid
43
40
exit 1
44
41
fi
45
- - name : Create release branch if not exists
42
+
43
+ # The Linux build will upload the local Nexus deployment repository
44
+ # (i.e., what will be deployed to OSSRH/Maven Central)
45
+ # and the Linux-specific bamm-cli binary to the build artifacts
46
+ build-linux :
47
+ name : Linux build
48
+ needs : [check-preconditions]
49
+ runs-on : ubuntu-20.04
50
+ steps :
51
+ - name : Checkout
52
+ uses : actions/checkout@v3
53
+
54
+ - name : Setup JDK
55
+ uses : graalvm/setup-graalvm@v1
56
+ with :
57
+ version : ' 22.3.1'
58
+ java-version : ' 17'
59
+ components : ' native-image,js'
60
+ github-token : ${{ secrets.GITHUB_TOKEN }}
61
+ native-image-job-reports : ' true'
62
+
63
+ - name : Cache Maven packages
64
+ uses : actions/cache@v3
65
+ with :
66
+ path : ~/.m2/repository
67
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
68
+ restore-keys : |
69
+ ${{ runner.os }}-maven-
70
+
71
+ - name : Set Swap Space (Linux)
72
+ uses : pierotofy/set-swap-space@master
73
+ with :
74
+ swap-size-gb : 12
75
+
76
+ # The Linux build will prepare a local Nexus staging repository
77
+ # that includes all .jars except the CLI jar
78
+ - name : Build and run tests
79
+ run : |
80
+ export MAVEN_OPTS="-Xmx4096m"
81
+ # Required for reactor dependencies
82
+ mvn clean install -DskipTests -Dmaven.javadoc.skip=true
83
+ mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
84
+ mvn versions:commit
85
+
86
+ # Actual build of core SDK
87
+ mvn -B -pl '!io.openmanufacturing:bamm-cli' clean deploy -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -DaltDeploymentRepository=local::default::file://nexus-staging -Psign
88
+ # Build of CLI
89
+ cd tools/bamm-cli
90
+ mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
91
+ mvn -B verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
92
+
93
+ # Create zip of bamm-cli
94
+ cd tools/bamm-cli/target
95
+ chmod a+x bamm
96
+ tar cfvz bamm-cli-linux.tar.gz bamm
97
+
98
+ - name : Upload staging directory and Linux binary
99
+ uses : actions/upload-artifact@v3
100
+ with :
101
+ name : linux-artifacts
102
+ path : |
103
+ nexus-staging/
104
+ tools/bamm-cli/target/bamm-cli-linux.tar.gz
105
+ tools/bamm-cli/target/bamm-cli-*.jar
106
+
107
+ # The Windows build will build the Windows-specific bamm-cli
108
+ # and upload the binary binary to the build artifacts
109
+ build-windows :
110
+ name : Windows build
111
+ needs : [check-preconditions]
112
+ runs-on : windows-latest
113
+ steps :
114
+ - name : Checkout
115
+ uses : actions/checkout@v3
116
+
117
+ - name : Setup JDK
118
+ uses : graalvm/setup-graalvm@v1
119
+ with :
120
+ version : ' 22.3.1'
121
+ java-version : ' 17'
122
+ components : ' native-image,js'
123
+ github-token : ${{ secrets.GITHUB_TOKEN }}
124
+ native-image-job-reports : ' true'
125
+
126
+ - name : Cache Maven packages
127
+ uses : actions/cache@v3
128
+ with :
129
+ path : ~/.m2/repository
130
+ key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
131
+ restore-keys : |
132
+ ${{ runner.os }}-maven-
133
+
134
+ - name : Configure Pagefile (Windows)
135
+ # Fix for "LINK : fatal error LNK1171: unable to load mspdbcore.dll (error code: 1455)":
136
+ # This seems to be caused by running out of memory; increasing page file
137
+ # size suggested here:
138
+ # https://github.com/actions/virtual-environments/issues/3420#issuecomment-861342418
139
+
140
+ with :
141
+ minimum-size : 16GB
142
+ maximum-size : 16GB
143
+ disk-root : " C:"
144
+
145
+ - name : Build and run tests
146
+ run : |
147
+ export MAVEN_OPTS="-Xmx4096m"
148
+ # Required for reactor dependencies
149
+ mvn clean install -DskipTests -Dmaven.javadoc.skip=true
150
+ mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
151
+ mvn versions:commit
152
+
153
+ # Actual build of core SDK
154
+ mvn -B -pl '!io.openmanufacturing:bamm-cli' clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
155
+ # Build of CLI
156
+ cd tools/bamm-cli
157
+ mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
158
+ mvn -B verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
159
+ shell : bash
160
+
161
+ - name : Upload Windows binary
162
+ uses : actions/upload-artifact@v3
163
+ with :
164
+ name : windows-artifacts
165
+ path : |
166
+ tools/bamm-cli/target/bamm.exe
167
+ tools/bamm-cli/target/*.dll
168
+ tools/bamm-cli/target/lib/
169
+
170
+ release :
171
+ needs : [build-linux, build-windows]
172
+ runs-on : ubuntu-latest
173
+ steps :
174
+ # Need to checkout here too, so that we have the pom.xml
175
+ # with the deployment info available
176
+ - name : Checkout
177
+ uses : actions/checkout@v3
178
+
179
+ - name : Set up JDK 17
180
+ uses : actions/setup-java@v2
181
+ with :
182
+ distribution : ' temurin'
183
+ java-version : ' 17'
184
+ server-id : ossrh
185
+ server-username : OSSRH_USERNAME
186
+ server-password : OSSRH_TOKEN
187
+ gpg-private-key : ${{ secrets.PGP_KEY }}
188
+ gpg-passphrase : PGP_KEY_PASSWORD
189
+ overwrite-settings : false
190
+
191
+ - name : Fetch Linux Artifacts
192
+ uses : actions/download-artifact@v3
193
+ with :
194
+ name : linux-artifacts
195
+
196
+ - name : Fetch Windows Artifacts
197
+ uses : actions/download-artifact@v3
198
+ with :
199
+ name : windows-artifacts
200
+
201
+ - name : Prepare release
202
+ run : |
203
+ # Create Windows CLI zip
204
+ zip -9 -r bamm-cli-windows.zip bamm.exe *.dll lib/
205
+
206
+ # Full release: Maven Central
207
+ - name : Release to OSSRH/Maven Central
208
+ if : ${{ !contains( github.event.inputs.release_version, '-M' ) }}
209
+ run : |
210
+ mvn nexus-staging:deploy-staged-repository -DrepositoryDirectory=nexus-staging -Prelease-build
211
+ env :
212
+ # Workaround for https://issues.sonatype.org/browse/OSSRH-66257
213
+ # as described in https://stackoverflow.com/a/70157413
214
+ MAVEN_OPTS : --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED
215
+
216
+ - name : Create release commit
46
217
continue-on-error : true
47
218
run : |
219
+ git config user.name github-actions
220
+ git config user.email [email protected]
221
+
48
222
release_version=${{ github.event.inputs.release_version }}
49
223
release_branch_name=${release_version%.*}.x
50
224
echo "release_branch_name=$release_branch_name" >> $GITHUB_ENV
51
225
52
226
git fetch
53
227
git checkout -b $release_branch_name --track origin/$release_branch_name || true
54
228
git checkout -b $release_branch_name
55
- - name : Set Maven version
56
- run : |
57
- mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true
229
+
230
+ # Set version in pom.xml files
231
+ mvn clean install -DskipTests -Dmaven.javadoc.skip=true
58
232
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
59
233
mvn versions:commit
60
- - name : Set Antora version
61
- uses : mikefarah/yq@master
62
- with :
63
- cmd : yq eval -i '.version = "${{ github.event.inputs.release_version }}"' documentation/developer-guide/antora.yml
64
- - name : Commit version changes and push to upstream repository
65
- run : |
234
+ # Set version in Antora module
235
+ yq eval -i '.version = "${{ github.event.inputs.release_version }}"' documentation/developer-guide/antora.yml
236
+ # Push changes
66
237
git add .
67
238
if git commit -m "Add version ${{ github.event.inputs.release_version}}"; then
68
239
git push origin ${{ env.release_branch_name }}
69
240
fi
70
- - name : Run tests and build
71
- run : mvn -B clean install
72
241
73
- # release-build
74
- - name : Create GitHub release
242
+ # Full release: Github
243
+ - name : " Create Github release (full) "
75
244
if : ${{ !contains( github.event.inputs.release_version, '-M' ) }}
76
245
uses : softprops/action-gh-release@v1
77
246
id : esmf_sdk_release
78
- with :
79
- body : " Release of ESMF SDK in version v ${{ github.event.inputs.release_version }}."
247
+ with :
248
+ body : " Release version ${{ github.event.inputs.release_version }}."
80
249
tag_name : v${{ github.event.inputs.release_version }}
81
250
target_commitish : ${{ env.release_branch_name }}
82
251
draft : false
83
252
prerelease : false
84
253
files : |
85
- **/target/*-${{ github.event.inputs.release_version }}.jar
254
+ bamm-cli-windows.zip
255
+ bamm-cli-linux.tar.gz
256
+ bamm-cli-*.jar
86
257
env :
87
258
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88
- - name : Publish to OSSRH
89
- if : ${{ !contains( github.event.inputs.release_version, '-M' ) }}
90
- run : mvn -B clean -pl '!esmf-sdk-test-report,!documentation,!tools/samm-cli' deploy -DskipTests -Prelease-build,sign
91
- env :
92
- OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
93
- OSSRH_TOKEN : ${{ secrets.OSSRH_TOKEN }}
94
- PGP_KEY_PASSWORD : ${{ secrets.PGP_KEY_PASSWORD }}
95
- # Workaround for https://issues.sonatype.org/browse/OSSRH-66257
96
- # as described in https://stackoverflow.com/a/70157413
97
- MAVEN_OPTS : --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED
98
259
99
- # milestone-build
100
- - name : Create GitHub release
101
- if : contains( github.event.inputs.release_version, '-M' )
102
- uses : softprops/action-gh-release@v1
103
- id : esmf_sdk_milestone_release
104
- with :
105
- body : " Release of ESMF SDK in version v${{ github.event.inputs.release_version }}."
106
- tag_name : v${{ github.event.inputs.release_version }}
107
- target_commitish : ${{ env.release_branch_name }}
108
- draft : false
109
- prerelease : true
110
- files : |
111
- **/target/*-${{ github.event.inputs.release_version }}.jar
112
- env :
113
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
260
+ # Milestone release: Write settings to deploy to Github repo
114
261
- name : Write settings.xml
115
262
if : contains( github.event.inputs.release_version, '-M' )
116
263
uses :
DamianReeves/[email protected]
@@ -140,9 +287,29 @@ jobs:
140
287
</servers>
141
288
</settings>
142
289
write-mode : overwrite
290
+
291
+ # Milestone release: Maven deploy to Github
143
292
- name : Publish to Github
144
293
if : contains( github.event.inputs.release_version, '-M' )
145
294
run : mvn -s ./settings.xml -B clean -pl '!esmf-sdk-test-report,!documentation,!tools/samm-cli' deploy -DskipTests -Pmilestone-build,sign
146
295
env :
147
296
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
148
297
PGP_KEY_PASSWORD : ${{ secrets.PGP_KEY_PASSWORD }}
298
+
299
+ # Milestone release: Github
300
+ - name : " Create Github release (milestone)"
301
+ if : contains( github.event.inputs.release_version, '-M' )
302
+ uses : softprops/action-gh-release@v1
303
+ id : sds_sdk_release
304
+ with :
305
+ body : " Release version ${{ github.event.inputs.release_version }}."
306
+ tag_name : v${{ github.event.inputs.release_version }}
307
+ target_commitish : ${{ env.release_branch_name }}
308
+ draft : false
309
+ prerelease : true
310
+ files : |
311
+ bamm-cli-windows.zip
312
+ bamm-cli-linux.tar.gz
313
+ bamm-cli-*.jar
314
+ env :
315
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments