Repository navigation
469 lines (421 loc) · 15.9 KB
/
Copy pathdocker.yml
File metadata and controls
469 lines (421 loc) · 15.9 KB
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
name: Docker
on:
workflow_run:
workflows: ["Build"]
types: [completed]
concurrency:
group: docker-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
jobs:
changes:
name: Detect changed components
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
outputs:
build_base: ${{ steps.set-matrix.outputs.build_base }}
build_uhc: ${{ steps.set-matrix.outputs.build_uhc }}
build_factions: ${{ steps.set-matrix.outputs.build_factions }}
build_vanillagen: ${{ steps.set-matrix.outputs.build_vanillagen }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
base:
- 'NGEssentials/**'
- 'Dockerfile'
- 'shared/**'
- 'scripts/**'
- 'libraries/**'
- '.github/workflows/docker.yml'
lobby:
- 'Lobby/**'
- 'shared/**'
- 'scripts/**'
skywars:
- 'Skywars/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
bedwars:
- 'Bedwars/**'
- 'shared/**'
- 'scripts/**'
conquests:
- 'Conquests/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
duels:
- 'Duels/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
mommasays:
- 'MommaSays/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
murdermystery:
- 'MurderMystery/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
soccer:
- 'Soccer/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
thebridge:
- 'TheBridge/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
survivalgames:
- 'SurvivalGames/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
meltdown:
- 'Meltdown/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
uhc:
- 'UHC/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
skyblock:
- 'SkyBlock/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
factions:
- 'Factions/**'
- 'libraries/**'
- 'shared/**'
- 'scripts/**'
- name: Build matrix
id: set-matrix
env:
MSG: ${{ github.event.workflow_run.head_commit.message }}
run: |
FORCE_ALL=false
if echo "$MSG" | grep -qE '\[All\]'; then
FORCE_ALL=true
fi
BUILD_BASE=false
if [ "$FORCE_ALL" = "true" ] || [ "${{ steps.filter.outputs.base }}" = "true" ] || echo "$MSG" | grep -qE '\[Base\]'; then
BUILD_BASE=true
fi
BUILD_UHC=false
if [ "$FORCE_ALL" = "true" ] || [ "${{ steps.filter.outputs.uhc }}" = "true" ]; then
BUILD_UHC=true
fi
BUILD_FACTIONS=false
if [ "$FORCE_ALL" = "true" ] || [ "${{ steps.filter.outputs.factions }}" = "true" ]; then
BUILD_FACTIONS=true
fi
BUILD_VANILLAGEN=false
if [ "$BUILD_UHC" = "true" ] || [ "$BUILD_FACTIONS" = "true" ]; then
BUILD_VANILLAGEN=true
fi
ALL='[
{"plugin":"Lobby","artifact":"xLobby","phar":"xLobby.phar","tag":"lobby"},
{"plugin":"Skywars","artifact":"xSkywars","phar":"xSkywars.phar","tag":"skywars"},
{"plugin":"Bedwars","artifact":"xBedwars","phar":"xBedwars.phar","tag":"bedwars"},
{"plugin":"Conquests","artifact":"xConquests","phar":"xConquests.phar","tag":"conquests"},
{"plugin":"Duels","artifact":"xDuels","phar":"xDuels.phar","tag":"duels"},
{"plugin":"MommaSays","artifact":"xMommaSays","phar":"xMommaSays.phar","tag":"mommasays"},
{"plugin":"MurderMystery","artifact":"xMurderMystery","phar":"xMurderMystery.phar","tag":"murdermystery"},
{"plugin":"Soccer","artifact":"xSoccer","phar":"xSoccer.phar","tag":"soccer"},
{"plugin":"TheBridge","artifact":"xTheBridge","phar":"xTheBridge.phar","tag":"thebridge"},
{"plugin":"SurvivalGames","artifact":"xSurvivalGames","phar":"xSurvivalGames.phar","tag":"survivalgames"},
{"plugin":"Meltdown","artifact":"xMeltdown","phar":"xMeltdown.phar","tag":"meltdown"},
{"plugin":"SkyBlock","artifact":"xSkyBlock","phar":"xSkyBlock.phar","tag":"skyblock"}
]'
if [ "$FORCE_ALL" = "true" ]; then
INCLUDE=$(echo "$ALL" | jq -c '.')
else
INCLUDE='[]'
if [ "${{ steps.filter.outputs.lobby }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[0]]')
fi
if [ "${{ steps.filter.outputs.skywars }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[1]]')
fi
if [ "${{ steps.filter.outputs.bedwars }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[2]]')
fi
if [ "${{ steps.filter.outputs.conquests }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[3]]')
fi
if [ "${{ steps.filter.outputs.duels }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[4]]')
fi
if [ "${{ steps.filter.outputs.mommasays }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[5]]')
fi
if [ "${{ steps.filter.outputs.murdermystery }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[6]]')
fi
if [ "${{ steps.filter.outputs.soccer }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[7]]')
fi
if [ "${{ steps.filter.outputs.thebridge }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[8]]')
fi
if [ "${{ steps.filter.outputs.survivalgames }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[9]]')
fi
if [ "${{ steps.filter.outputs.meltdown }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[10]]')
fi
if [ "${{ steps.filter.outputs.skyblock }}" = "true" ]; then
INCLUDE=$(echo "$INCLUDE" | jq -c --argjson all "$ALL" '. += [$all[11]]')
fi
fi
echo "build_base=$BUILD_BASE" >> $GITHUB_OUTPUT
echo "build_uhc=$BUILD_UHC" >> $GITHUB_OUTPUT
echo "build_factions=$BUILD_FACTIONS" >> $GITHUB_OUTPUT
echo "build_vanillagen=$BUILD_VANILLAGEN" >> $GITHUB_OUTPUT
echo "matrix={\"include\":$INCLUDE}" >> $GITHUB_OUTPUT
quiche:
name: Build quiche
needs: changes
runs-on: ubuntu-latest
if: "github.event.workflow_run.conclusion == 'success' && needs.changes.outputs.build_base == 'true'"
env:
QUICHE_VERSION: 0.29.2
steps:
- name: Cache quiche
id: cache-quiche
uses: actions/cache@v6
with:
path: quiche-build
key: "quiche-${{ env.QUICHE_VERSION }}"
- name: Install system dependencies
if: steps.cache-quiche.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev pkg-config
- uses: actions-rust-lang/setup-rust-toolchain@v2
if: steps.cache-quiche.outputs.cache-hit != 'true'
with:
build-warnings: warn
- name: Build quiche
if: steps.cache-quiche.outputs.cache-hit != 'true'
run: git clone --recursive https://github.com/cloudflare/quiche --branch "$QUICHE_VERSION" quiche-build && cd quiche-build && cargo build --release --features ffi
- name: Upload quiche build
uses: actions/upload-artifact@v7
with:
name: quiche-build
path: |
quiche-build/target/release/libquiche.so
quiche-build/quiche/include/quiche.h
vanillagenerator:
name: Build VanillaGenerator.phar
needs: changes
runs-on: ubuntu-latest
if: "github.event.workflow_run.conclusion == 'success' && needs.changes.outputs.build_vanillagen == 'true'"
steps:
- name: Checkout VanillaGenerator
uses: actions/checkout@v7
with:
repository: NetherGamesMC/VanillaGenerator
token: ${{ secrets.ng_token }}
path: VanillaGenerator
- name: Cache pharbuilder-rs
id: cache-pharbuilder
uses: actions/cache@v6
with:
path: pharbuilder
key: pharbuilder-rs-binary-v1
- name: Download pharbuilder-rs
if: steps.cache-pharbuilder.outputs.cache-hit != 'true'
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
file: pharbuilder
repo: NetherGamesMC/pharbuilder-rs
token: ${{ secrets.ng_token }}
- name: Build
run: |
chmod +x pharbuilder
./pharbuilder -i ./VanillaGenerator -o ./VanillaGenerator.phar
- name: Upload
uses: actions/upload-artifact@v7
with:
name: VanillaGenerator
path: VanillaGenerator.phar
base:
name: Build & push base image
needs: [changes, quiche]
runs-on: ubuntu-latest
if: "github.event.workflow_run.conclusion == 'success' && needs.changes.outputs.build_base == 'true'"
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Download quiche build
uses: actions/download-artifact@v8
with:
name: quiche-build
path: quiche-build-download
- name: Lay out quiche build
run: |
mkdir -p quiche-build/target/release quiche-build/quiche/include
cp quiche-build-download/target/release/libquiche.so quiche-build/target/release/libquiche.so
cp quiche-build-download/quiche/include/quiche.h quiche-build/quiche/include/quiche.h
- name: Download NGEssentials.phar
uses: actions/download-artifact@v8
with:
name: NGEssentials
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
path: .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4.7.0
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
push: true
tags: "nethergamesmc/servers:base"
game:
name: Build & push ${{ matrix.tag }} image
needs: [changes, base]
runs-on: ubuntu-latest
if: "!failure() && !cancelled() && github.event.workflow_run.conclusion == 'success' && needs.changes.outputs.matrix != '{\"include\":[]}'"
strategy:
fail-fast: false
max-parallel: 6
matrix: ${{ fromJSON(needs.changes.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Checkout assets
uses: actions/checkout@v7
with:
repository: NetherGamesMC/assets
token: ${{ secrets.ng_token }}
path: assets
- name: Download ${{ matrix.phar }}
uses: actions/download-artifact@v8
with:
name: ${{ matrix.artifact }}
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
path: .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4.7.0
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ./${{ matrix.plugin }}/Dockerfile
push: true
tags: "nethergamesmc/servers:${{ matrix.tag }}"
build-args: "BUILD_FROM=nethergamesmc/servers:base"
game-uhc:
name: Build & push uhc image
needs: [changes, base, vanillagenerator]
runs-on: ubuntu-latest
if: "!failure() && !cancelled() && github.event.workflow_run.conclusion == 'success' && needs.changes.outputs.build_uhc == 'true'"
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Checkout assets
uses: actions/checkout@v7
with:
repository: NetherGamesMC/assets
token: ${{ secrets.ng_token }}
path: assets
- name: Download xUHC.phar
uses: actions/download-artifact@v8
with:
name: xUHC
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
path: .
- name: Download VanillaGenerator.phar
uses: actions/download-artifact@v8
with:
name: VanillaGenerator
path: .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4.7.0
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ./UHC/Dockerfile
push: true
tags: "nethergamesmc/servers:uhc"
build-args: "BUILD_FROM=nethergamesmc/servers:base"
game-factions:
name: Build & push factions image
needs: [changes, base, vanillagenerator]
runs-on: ubuntu-latest
if: "!failure() && !cancelled() && github.event.workflow_run.conclusion == 'success' && needs.changes.outputs.build_factions == 'true'"
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Checkout assets
uses: actions/checkout@v7
with:
repository: NetherGamesMC/assets
token: ${{ secrets.ng_token }}
path: assets
- name: Download xFactions.phar
uses: actions/download-artifact@v8
with:
name: xFactions
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
path: .
- name: Download VanillaGenerator.phar
uses: actions/download-artifact@v8
with:
name: VanillaGenerator
path: .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4.7.0
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ./Factions/Dockerfile
push: true
tags: "nethergamesmc/servers:factions"
build-args: "BUILD_FROM=nethergamesmc/servers:base"