This repository has been archived by the owner on Oct 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
269 lines (265 loc) · 12 KB
/
deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# Brings in AdoptOpenJDK (same as in Docker image) to build and deploy the release.
name: Deployment
on:
push:
branches:
- master
- '[0-9]+.[0-9]+.x'
tags:
- robozonky-[0-9]+.[0-9]+.[0-9]+*
# Uncomment below to debug this workflow in CI.
pull_request:
branches:
- master
env:
RUNTIME_JDK_VERSION: 16.0.1
JLINK_SCRIPT_FILENAME: .github/workflows/jlink.sh
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
shell: bash
jobs:
test:
name: Ensure that the tests pass
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up AdoptOpenJDK with sdkman
uses: sdkman/sdkman-action@master
with:
candidate: java
version: ${{ env.RUNTIME_JDK_VERSION }}.hs-adpt
- name: Install Java and Maven
uses: actions/setup-java@v1
with:
java-version: ${{ env.RUNTIME_JDK_VERSION }}
jdkFile: ${{ steps.sdkman.outputs.file }}
# See https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and test
run: mvn install --batch-mode -Dpit.skip=true
jlink:
name: Prepare JREs
needs: test
strategy:
fail-fast: false # Always see all results on all platforms.
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up AdoptOpenJDK with sdkman
uses: sdkman/sdkman-action@master
with:
candidate: java
version: ${{ env.RUNTIME_JDK_VERSION }}.hs-adpt
- name: Install Java and Maven
uses: actions/setup-java@v1
with:
java-version: ${{ env.RUNTIME_JDK_VERSION }}
jdkFile: ${{ steps.sdkman.outputs.file }}
# See https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Run the build
run: mvn install --batch-mode -DskipTests
- name: Determine RoboZonky version
run: |
ROBOZONKY_VERSION=$(mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec \
)
echo "The detected RoboZonky version is $ROBOZONKY_VERSION"
echo "ROBOZONKY_VERSION=$ROBOZONKY_VERSION" >> $GITHUB_ENV
# Avoid proliferation of Ubuntu and remove the -latest suffix.
- name: This is Mac OS X
if: startsWith(matrix.os, 'macos')
run: |
echo "ROBOZONKY_OS=macos" >> $GITHUB_ENV
- name: This is Windows
if: startsWith(matrix.os, 'windows')
run: |
echo "ROBOZONKY_OS=windows" >> $GITHUB_ENV
- name: This is Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
echo "ROBOZONKY_OS=linux" >> $GITHUB_ENV
# Build and publish the JLinked JRE.
- name: Run JLink for the JARs
run: |
chmod +x ${{ env.JLINK_SCRIPT_FILENAME }}
./${{ env.JLINK_SCRIPT_FILENAME }} robozonky-app/target/robozonky-app-${{ env.ROBOZONKY_VERSION }}-full.jar robozonky-jre
./${{ env.JLINK_SCRIPT_FILENAME }} robozonky-installer/target/robozonky-installer-${{ env.ROBOZONKY_VERSION }}-full.jar robozonky-installer-jre
- name: Upload JLinked app JRE
uses: actions/upload-artifact@v2
with:
name: robozonky-jre-${{ env.ROBOZONKY_OS }}
path: robozonky-jre/**/*
- name: Upload JLinked installer JRE
uses: actions/upload-artifact@v2
with:
name: robozonky-installer-jre-${{ env.ROBOZONKY_OS }}
path: robozonky-installer-jre/**/*
build:
name: Build and deploy
needs: jlink
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up AdoptOpenJDK with sdkman
uses: sdkman/sdkman-action@master
with:
candidate: java
version: ${{ env.RUNTIME_JDK_VERSION }}.hs-adpt
- name: Install Java and Maven
uses: actions/setup-java@v1
with:
java-version: ${{ env.RUNTIME_JDK_VERSION }}
jdkFile: ${{ steps.sdkman.outputs.file }}
# See https://docs.github.com/en/actions/guides/building-and-testing-java-with-maven#caching-dependencies
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download Linux main app JRE
uses: actions/download-artifact@v2
with:
name: robozonky-jre-linux
path: robozonky-distribution/robozonky-distribution-full/target/jre-linux
- name: Download MacOS main app JRE
uses: actions/download-artifact@v2
with:
name: robozonky-jre-macos
path: robozonky-distribution/robozonky-distribution-full/target/jre-macos
- name: Download Windows main app JRE
uses: actions/download-artifact@v2
with:
name: robozonky-jre-windows
path: robozonky-distribution/robozonky-distribution-full/target/jre-windows
- name: Download Linux installer JRE
uses: actions/download-artifact@v2
with:
name: robozonky-installer-jre-linux
path: robozonky-distribution/robozonky-distribution-installer/target/jre-linux
- name: Download MacOS installer JRE
uses: actions/download-artifact@v2
with:
name: robozonky-installer-jre-macos
path: robozonky-distribution/robozonky-distribution-installer/target/jre-macos
- name: Download Windows installer JRE
uses: actions/download-artifact@v2
with:
name: robozonky-installer-jre-windows
path: robozonky-distribution/robozonky-distribution-installer/target/jre-windows
- name: Build, sign and deploy
uses: samuelmeuli/action-maven-publish@v1
with:
maven_goals_phases: deploy # Don't call "clean", or else all the downloaded JREs would disappear.
# Enable release profile; attempt to resolve intermittent connection issues.
# See https://stackoverflow.com/questions/55899091/maven-retry-dependency-download-if-failed.
maven_args: "-Drobozonky.release.profile=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false"
gpg_private_key: ${{ secrets.MAVEN_CENTRAL_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.MAVEN_CENTRAL_PRIVATE_KEY_PASSWORD }}
server_id: ossrh
nexus_username: ${{ secrets.MAVEN_CENTRAL_ACCOUNT_NAME }}
nexus_password: ${{ secrets.MAVEN_CENTRAL_ACCOUNT_PASSWORD }}
- name: Determine RoboZonky version
run: |
ROBOZONKY_VERSION=$(mvn -q \
-Dexec.executable="echo" \
-Dexec.args='${project.version}' \
--non-recursive \
org.codehaus.mojo:exec-maven-plugin:1.6.0:exec \
)
echo "The detected RoboZonky version is $ROBOZONKY_VERSION"
echo "ROBOZONKY_VERSION=$ROBOZONKY_VERSION" >> $GITHUB_ENV
# If this is not a SNAPSHOT, create a Github Release and upload all the artifacts there.
- name: Create Github Release
id: create_release
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Main app (Windows, x64)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-full/target/robozonky-distribution-full-${{ env.ROBOZONKY_VERSION }}-windows-x64.zip
asset_name: robozonky-${{ env.ROBOZONKY_VERSION }}-windows-x64.zip
asset_content_type: application/zip
- name: Upload Main app (MacOS, x64)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-full/target/robozonky-distribution-full-${{ env.ROBOZONKY_VERSION }}-macos-x64.tar.gz
asset_name: robozonky-${{ env.ROBOZONKY_VERSION }}-macos-x64.tar.gz
asset_content_type: application/gzip
- name: Upload Main app (Linux, x64)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-full/target/robozonky-distribution-full-${{ env.ROBOZONKY_VERSION }}-linux-x64.tar.xz
asset_name: robozonky-${{ env.ROBOZONKY_VERSION }}-linux-x64.tar.xz
asset_content_type: application/x-xz
- name: Upload Main app (noarch)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-full/target/robozonky-distribution-full-${{ env.ROBOZONKY_VERSION }}-noarch.zip
asset_name: robozonky-${{ env.ROBOZONKY_VERSION }}-noarch.zip
asset_content_type: application/zip
- name: Upload Installer (Windows, x64)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-installer/target/robozonky-distribution-installer-${{ env.ROBOZONKY_VERSION }}-windows-x64.zip
asset_name: robozonky-installer-${{ env.ROBOZONKY_VERSION }}-windows-x64.zip
asset_content_type: application/zip
- name: Upload Installer (MacOS, x64)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-installer/target/robozonky-distribution-installer-${{ env.ROBOZONKY_VERSION }}-macos-x64.tar.gz
asset_name: robozonky-installer-${{ env.ROBOZONKY_VERSION }}-macos-x64.tar.gz
asset_content_type: application/gzip
- name: Upload Installer (Linux, x64)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-installer/target/robozonky-distribution-installer-${{ env.ROBOZONKY_VERSION }}-linux-x64.tar.xz
asset_name: robozonky-installer-${{ env.ROBOZONKY_VERSION }}-linux-x64.tar.xz
asset_content_type: application/x-xz
- name: Upload Installer (noarch)
if: false == contains(env.ROBOZONKY_VERSION, 'SNAPSHOT')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: robozonky-distribution/robozonky-distribution-installer/target/robozonky-distribution-installer-${{ env.ROBOZONKY_VERSION }}-noarch.zip
asset_name: robozonky-installer-${{ env.ROBOZONKY_VERSION }}-noarch.zip
asset_content_type: application/zip