-
Notifications
You must be signed in to change notification settings - Fork 44
392 lines (323 loc) · 10.9 KB
/
build.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
name: Build
on:
push:
branches:
- master
- experimental
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
uses: arma-actions/mikero-tools@latest
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Build
run: npm run build
- name: Pack (windows)
run: npm run pack:windows
- name: Zip Artifacts (windows)
run: powershell Compress-Archive -Path 'build/*' -DestinationPath 'server-manager.zip'
- name: Archive build artifacts (windows)
uses: actions/upload-artifact@v2
with:
name: server-manager-windows
path: ./server-manager.zip
build-windows-debug:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
uses: arma-actions/mikero-tools@latest
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Set mod debug flags
run: |
echo "#define DayZServerManager" > "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
echo "#define DZSM_DEBUG" >> "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
echo "#define DZSM_DEBUG_CONTAINER" >> "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
- name: Set manager debug flags
run: |
echo "export const dzsmDebugHttp = true;" > "src/config/constants.ts"
echo "export const dzsmDebugLogReader = true;" >> "src/config/constants.ts"
echo "export const dzsmDebugProcessList = true;" >> "src/config/constants.ts"
- name: Build
run: npm run build
- name: Pack (windows)
run: npm run pack:windows
- name: Zip Artifacts (windows)
run: powershell Compress-Archive -Path 'build/*' -DestinationPath 'server-manager.zip'
- name: Archive build artifacts (windows)
uses: actions/upload-artifact@v2
with:
name: server-manager-windows-debug
path: ./server-manager.zip
build-ubuntu-18:
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
env:
npm_config_cache: ./.npm-cache
PKG_CACHE_PATH: ./.pkg-cache
steps:
- uses: actions/checkout@v2
- name: Install build tools
run: |
apt-get update && \
apt-get install -y \
make \
python3 \
python \
build-essential \
libvorbisenc2 \
liblzo2-dev \
libvorbisfile3 \
libuchardet-dev \
curl \
zip \
&& \
chmod -R 777 . && \
chown -R 777 "/github/home"
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
# uses: arma-actions/mikero-tools@latest
run: |
mkdir -p /opt/mikero-tools
curl -fsSL "https://raw.githubusercontent.com/arma-actions/mikero-tools/latest/linux/depbo-tools-0.9.13-linux-amd64.tgz" -o depbo-tools.tgz
tar -zxf depbo-tools.tgz --strip-components=1 -C /opt/mikero-tools
echo "Updating environment variables"
echo "/opt/mikero-tools/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/mikero-tools/lib" >> $GITHUB_ENV
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Build
run: npm run build
- name: Pack (ubuntu-18)
run: npm run pack:linux
- name: Zip Artifacts (ubuntu-18)
run: zip -r server-manager.zip build/*
- name: Archive build artifacts (ubuntu-18)
uses: actions/upload-artifact@v2
with:
name: server-manager-ubuntu-18
path: ./server-manager.zip
build-ubuntu-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install build tools
run: sudo apt-get install -y make python3 python2 build-essential
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: download mikeros tools
uses: arma-actions/mikero-tools@latest
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}
- name: Build
run: npm run build
- name: Pack (ubuntu latest)
run: npm run pack:linux
- name: Zip Artifacts (ubuntu latest)
run: zip -r server-manager.zip build/*
- name: Archive build artifacts (ubuntu latest)
uses: actions/upload-artifact@v2
with:
name: server-manager-ubuntu-latest
path: ./server-manager.zip
build-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- build-ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download artifacts (ubuntu latest)
uses: actions/download-artifact@v2
with:
name: server-manager-ubuntu-latest
- name: Unpack artifact
run: unzip server-manager.zip
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui
- name: Test
run: npm test | tee test-output.log ; test ${PIPESTATUS[0]} -eq 0
- name: Prepare coverage badge
if: contains('refs/heads/master refs/heads/experimental', github.ref)
run: |
SUMMARY="$(cat test-output.log | tail -3 | head -1)"
TOKENS=($SUMMARY)
echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV
REF=${{ github.ref }}
echo "github.ref: $REF"
IFS='/' read -ra PATHS <<< "$REF"
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
echo $BRANCH_NAME
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
- name: Create the Badge
uses: schneegans/[email protected]
if: contains('refs/heads/master refs/heads/experimental', github.ref)
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 442a5cdea03dd79a87b34339a7a16a2c
filename: dayz-server-manager__${{ env.BRANCH }}.json
label: Test Coverage
message: ${{ env.COVERAGE }}
color: green
namedLogo: typescript
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- test
- build-ubuntu-18
- build-ubuntu-latest
- build-windows
- build-windows-debug
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Download artifacts (windows)
uses: actions/download-artifact@v2
with:
name: server-manager-windows
- name: Rename
run: |
mv server-manager.zip server-manager-windows.zip
- name: Upload Release Asset (Windows)
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-windows.zip
asset_name: server-manager-windows.zip
asset_content_type: application/zip
- name: Download artifacts (windows debug)
uses: actions/download-artifact@v2
with:
name: server-manager-windows-debug
- name: Rename
run: |
mv server-manager.zip server-manager-windows-debug.zip
- name: Upload Release Asset (Windows Debug)
id: upload-release-asset-windows-debug
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-windows-debug.zip
asset_name: server-manager-windows-debug.zip
asset_content_type: application/zip
- name: Download artifacts (ubuntu 18)
uses: actions/download-artifact@v2
with:
name: server-manager-ubuntu-18
- name: Rename
run: |
mv server-manager.zip server-manager-ubuntu-18.zip
- name: Upload Release Asset (Ubuntu 18)
id: upload-release-asset-ubuntu-18
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-ubuntu-18.zip
asset_name: server-manager-ubuntu-18.zip
asset_content_type: application/zip
- name: Download artifacts (ubuntu latest)
uses: actions/download-artifact@v2
with:
name: server-manager-ubuntu-latest
- name: Rename
run: |
mv server-manager.zip server-manager-ubuntu-latest.zip
- name: Upload Release Asset (Ubuntu latest)
id: upload-release-asset-ubuntu-latest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-ubuntu-latest.zip
asset_name: server-manager-ubuntu-latest.zip
asset_content_type: application/zip