-
Notifications
You must be signed in to change notification settings - Fork 0
354 lines (309 loc) · 12.5 KB
/
release.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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
#thanks to https://github.com/recursivecodes/simple-socket-fn-logger/blob/master/.github/workflows/simple-socket-fn-logger.yaml
name: Release
on:
push:
tags:
- "v*"
jobs:
build-jar:
name: Runnable Jar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Get Version Number
id: get_version
run: |
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
echo ::set-output name=VERSION_BUILD::$(./gradlew cli:properties -q -PossrhUsername=inv4lid -PossrhPassword=inv4lid | grep "version:" | awk '{print $2}')
- name: Runnable Jar
run: |
./gradlew test quarkusBuild --uber-jar -PossrhUsername=inv4lid -PossrhPassword=inv4lid
cp cli/build/snip.jar cli/build/snip-${{steps.get_version.outputs.VERSION}}.jar
- name: Publish JAR
uses: actions/upload-artifact@v2-preview
with:
name: snip-${{steps.get_version.outputs.VERSION}}.jar
path: cli/build/*.jar
- name: Create Release
if: contains(github.ref, 'v')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: Release ${{github.ref}}
body: |
Initial release
draft: true
prerelease: false
- name: Upload Release Asset
if: contains(github.ref, 'v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: cli/build/snip-${{steps.get_version.outputs.VERSION}}.jar
asset_name: snip-${{steps.get_version.outputs.VERSION}}-all.jar
asset_content_type: application/java-archive
- name: Write Upload URL To File
if: contains(github.ref, 'v')
run: |
echo "${{steps.create_release.outputs.upload_url}}" > upload_url.txt
- name: Publish Upload URL
if: contains(github.ref, 'v')
uses: actions/upload-artifact@v2-preview
with:
name: 'upload_url.txt'
path: 'upload_url.txt'
build-native-image:
name: Build Non-Windows Image
needs: [build-jar]
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
include:
- os: 'ubuntu-latest'
label: 'linux'
- os: 'macos-latest'
label: 'mac'
runs-on: ${{matrix.os}}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Setup GraalVM Environment
uses: DeLaGuardo/setup-graalvm@4.0
with:
graalvm: '21.0.0.2'
java: 'java11'
arch: 'amd64'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Install Native Image Plugin
run: |
gu install native-image
- name: Get Version Number
id: get_version
run: |
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
echo ::set-output name=VERSION_BUILD::$(./gradlew cli:properties -q -PossrhUsername=inv4lid -PossrhPassword=inv4lid | grep "version:" | awk '{print $2}')
- name: Get JAR Artifact
uses: actions/download-artifact@v2-preview
with:
name: snip-${{steps.get_version.outputs.VERSION}}.jar
- name: 'Get Release URL'
if: contains(github.ref, 'v')
uses: actions/download-artifact@v2-preview
with:
name: 'upload_url.txt'
- name: 'Get Upload URL'
id: get_url
if: contains(github.ref, 'v')
run: |
echo ::set-output name=UPLOAD_URL::$(cat upload_url.txt)
- name: Build Native
run: |
./gradlew clean build --no-daemon -Dquarkus.package.type=native \
-Dquarkus.native.container-build=false \
-Dquarkus.native.additional-build-args=-H:EnableURLProtocols=https,-H:IncludeResources='.*json$',--no-fallback \
-PossrhUsername=inv4lid -PossrhPassword=inv4lid
- name: Copy Natine Artifact
if: success()
shell: bash
run: |
cp cli/build/snip snip-${{steps.get_version.outputs.VERSION}}
cp cli/build/snip snip
- name: Publish Native Image
if: success()
uses: actions/upload-artifact@v2-preview
with:
name: 'snip-${{steps.get_version.outputs.VERSION}}-${{matrix.label}}'
path: 'snip-${{steps.get_version.outputs.VERSION}}'
- name: Release Native Image Asset
if: success() && contains(github.ref, 'v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.get_url.outputs.UPLOAD_URL}}
asset_name: 'snip-${{steps.get_version.outputs.VERSION}}-${{matrix.label}}'
asset_path: 'snip-${{steps.get_version.outputs.VERSION}}'
asset_content_type: application/octet-stream
- uses: kentik/pkg@v1.0.0-rc6
if: success() && contains(matrix.label, 'linux')
name: Build rpm Package
with:
name: snip
version: ${{steps.get_version.outputs.VERSION_BUILD}}
arch: x86_64
format: rpm
package: linux-package.yaml
- name: Fix rpm Package Name
if: success() && contains(matrix.label, 'linux')
shell: bash
run: |
cp snip-${{steps.get_version.outputs.VERSION_BUILD}}-1.x86_64.rpm snip-${{steps.get_version.outputs.VERSION}}.x86_64.rpm
- name: Publish rpm Package
if: success() && contains(matrix.label, 'linux')
uses: actions/upload-artifact@v2-preview
with:
name: 'snip-${{steps.get_version.outputs.VERSION}}.x86_64.rpm'
path: 'snip-${{steps.get_version.outputs.VERSION}}.x86_64.rpm'
- name: Release rpm Package
if: success() && contains(matrix.label, 'linux')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.get_url.outputs.UPLOAD_URL}}
asset_name: 'snip-${{steps.get_version.outputs.VERSION}}.x86_64.rpm'
asset_path: 'snip-${{steps.get_version.outputs.VERSION}}.x86_64.rpm'
asset_content_type: application/octet-stream
- uses: kentik/pkg@v1.0.0-rc6
if: success() && contains(matrix.label, 'linux')
name: Build deb Package
with:
name: snip
version: ${{steps.get_version.outputs.VERSION_BUILD}}
arch: x86_64
format: deb
package: linux-package.yaml
- name: Fix deb Package Name
if: success() && contains(matrix.label, 'linux')
shell: bash
run: |
cp snip_${{steps.get_version.outputs.VERSION_BUILD}}-1_amd64.deb snip_${{steps.get_version.outputs.VERSION}}_amd64.deb
- name: Publish deb Package
if: success() && contains(matrix.label, 'linux')
uses: actions/upload-artifact@v2-preview
with:
name: 'snip_${{steps.get_version.outputs.VERSION}}_amd64.deb'
path: 'snip_${{steps.get_version.outputs.VERSION}}_amd64.deb'
- name: Release deb Package
if: success() && contains(matrix.label, 'linux')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.get_url.outputs.UPLOAD_URL}}
asset_name: 'snip_${{steps.get_version.outputs.VERSION}}_amd64.deb'
asset_path: 'snip_${{steps.get_version.outputs.VERSION}}_amd64.deb'
asset_content_type: application/octet-stream
build-windows-image:
needs: [build-jar]
name: Build Windows Image
runs-on: windows-2022
steps:
- name: 'Checkout'
uses: actions/checkout@v1
- name: 'Download GraalVM'
run: |
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.0.0.2/graalvm-ce-java11-windows-amd64-21.0.0.2.zip -OutFile 'graal.zip'
- name: 'Install GraalVM'
run: |
Expand-Archive -path 'graal.zip' -destinationpath '.'
- name: 'Install Native Image'
run: |
graalvm-ce-java11-21.0.0.2\bin\gu.cmd install native-image
- name: 'Set up Visual C Build Tools Workload for Visual Studio 2017 Build Tools'
run: |
choco install visualstudio2017-workload-vctools -vy
- name: 'Get Version Number'
id: get_version
run: |
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
echo ::set-output name=VERSION_BUILD::$(./gradlew cli:properties -q -PossrhUsername=inv4lid -PossrhPassword=inv4lid | grep "version:" | awk '{print $2}')
shell: bash
- name: Build Native
shell: cmd
env:
JAVA_HOME: ./graalvm-ce-java11-21.0.0.2
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
./gradlew.bat build --no-daemon -Dquarkus.package.type=native ^
-Dquarkus.native.container-build=false ^
-Dquarkus.native.graalvm-home=$(pwd)/graalvm-ce-java11-21.0.0.2 ^
-Dquarkus.native.additional-build-args=-H:EnableURLProtocols=https,-H:IncludeResources=.*json$,-H:Log=registerResource:,--no-fallback ^
-PossrhUsername=inv4lid -PossrhPassword=inv4lid
- name: Copy Natine Artifact
shell: bash
run: |
cp cli/build/snip.exe snip.exe
- name: Copy VCRuntime
shell: bash
run: |
cp /c/Windows/System32/VCRUNTIME140.dll .
- name: Zip
shell: pwsh
run: |
Compress-Archive -Path VCRUNTIME140.dll, snip.exe -CompressionLevel Optimal -DestinationPath snip-${{steps.get_version.outputs.VERSION}}-windows.zip
- name: Inno Setup
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "windows\inno.iss"
shell: cmd
- name: Copy Setup
shell: bash
run: |
cp windows/Output/mysetup.exe snip-${{steps.get_version.outputs.VERSION}}-windows-setup.exe
- name: 'Get Release URL'
if: contains(github.ref, 'v')
uses: actions/download-artifact@v2-preview
with:
name: 'upload_url.txt'
- name: 'Get Upload URL'
id: get_url
if: contains(github.ref, 'v')
run: |
echo "::set-output name=UPLOAD_URL::$(cat upload_url.txt)"
shell: bash
- name: 'Publish Windows Image'
if: success()
uses: actions/upload-artifact@v2-preview
with:
name: snip-${{steps.get_version.outputs.VERSION}}-windows.zip
path: snip-${{steps.get_version.outputs.VERSION}}-windows.zip
- name: 'Publish Windows Setup'
if: success()
uses: actions/upload-artifact@v2-preview
with:
name: snip-${{steps.get_version.outputs.VERSION}}-windows-setup.exe
path: snip-${{steps.get_version.outputs.VERSION}}-windows-setup.exe
- name: 'Release Windows Image Asset'
if: success() && contains(github.ref, 'v')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.get_url.outputs.UPLOAD_URL}}
asset_name: snip-${{steps.get_version.outputs.VERSION}}-windows.zip
asset_path: snip-${{steps.get_version.outputs.VERSION}}-windows.zip
asset_content_type: application/octet-stream
- name: 'Release Windows Setup'
if: success() && contains(github.ref, 'v')
id: upload-release-setup
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.get_url.outputs.UPLOAD_URL}}
asset_name: snip-${{steps.get_version.outputs.VERSION}}-windows-setup.exe
asset_path: snip-${{steps.get_version.outputs.VERSION}}-windows-setup.exe
asset_content_type: application/octet-stream