-
Notifications
You must be signed in to change notification settings - Fork 9
456 lines (400 loc) · 16.1 KB
/
upload-to-r2.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
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
name: Upload to R2
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
Fetch:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
git clone --depth 1 https://github.com/CollapseLauncher/CollapseLauncher-ReleaseRepo.git cl-cdn
- name: Clean unused objects
run: |
rm -rf ./cl-cdn/.git
rm -rf ./cl-cdn/.github
rm -rf ./cl-cdn/actions
rm -rf ./cl-cdn/.gitignore
rm -rf ./cl-cdn/LICENSE
rm -rf ./cl-cdn/pack.bat
- name: Move folders around
run: |
echo Root folder
mkdir -p ./cl-cdn/folderroot
mv ./cl-cdn/ApplyUpdate.exe ./cl-cdn/changelog_preview.md ./cl-cdn/changelog_stable.md ./cl-cdn/CollapseLauncher.Hi3CacheUpdater.cmd ./cl-cdn/folderroot/
mv ./cl-cdn/notification_notepreview ./cl-cdn/notification_notestable ./cl-cdn/notification_preview.json ./cl-cdn/notification_stable.json ./cl-cdn/Update.exe ./cl-cdn/folderroot/
echo Metadata
mkdir -p ./cl-cdn/metadata/metadata-root
mkdir -p ./cl-cdn/metadata/metadata-root/v3
mv ./cl-cdn/metadata/v3/* ./cl-cdn/metadata/metadata-root/v3/
mv ./cl-cdn/metadata/metadatav2_previewconfig.json ./cl-cdn/metadata/metadatav2_previewstamp.json ./cl-cdn/metadata/metadata-root/
mv ./cl-cdn/metadata/metadatav2_stableconfig.json ./cl-cdn/metadata/metadatav2_stablestamp.json ./cl-cdn/metadata/metadata-root/
echo Images
mkdir -p ./cl-cdn/metadata/metadata-images/game_logos
mkdir -p ./cl-cdn/metadata/metadata-images/game_posters
mkdir -p ./cl-cdn/metadata/metadata-images/steam_assets
mv ./cl-cdn/metadata/game_logos/* ./cl-cdn/metadata/metadata-images/game_logos/
mv ./cl-cdn/metadata/game_posters/* ./cl-cdn/metadata/metadata-images/game_posters/
mv ./cl-cdn/metadata/steam_assets/* ./cl-cdn/metadata/metadata-images/steam_assets/
echo ApplyUpdate
mkdir -p ./cl-cdn/applyupdate/stable
mkdir -p ./cl-cdn/applyupdate/preview
mv ./cl-cdn/preview ./cl-cdn/applyupdate/
mv ./cl-cdn/stable ./cl-cdn/applyupdate/
- name: Archive objects
run: |
zip -0 -r root-cdn.zip ./cl-cdn/folderroot
zip -0 -r root-metadata.zip ./cl-cdn/metadata/metadata-root
zip -0 -r gameimages.zip ./cl-cdn/metadata/metadata-images
zip -0 -r indexes_hi3.zip ./cl-cdn/metadata/repair_indexes/Hi3CN ./cl-cdn/metadata/repair_indexes/Hi3Global ./cl-cdn/metadata/repair_indexes/Hi3JP ./cl-cdn/metadata/repair_indexes/Hi3KR ./cl-cdn/metadata/repair_indexes/Hi3SEA ./cl-cdn/metadata/repair_indexes/Hi3TW
zip -0 -r indexes_hsr.zip ./cl-cdn/metadata/repair_indexes/SRCN ./cl-cdn/metadata/repair_indexes/HSRCNBilibili ./cl-cdn/metadata/repair_indexes/SRGlb
zip -0 -r indexes_zzz.zip ./cl-cdn/metadata/repair_indexes/ZZZBilibili ./cl-cdn/metadata/repair_indexes/ZZZCN ./cl-cdn/metadata/repair_indexes/ZZZGlb
zip -0 -r applyupdate.zip ./cl-cdn/applyupdate
zip -0 -r squirrel-stable.zip ./cl-cdn/squirrel/stable
zip -0 -r squirrel-preview.zip ./cl-cdn/squirrel/preview
zip -0 -r velopack-preview.zip ./cl-cdn/velopack/preview
zip -0 -r velopack-stable.zip ./cl-cdn/velopack/stable
- name: Upload root-cdn
uses: actions/[email protected]
with:
name: root-cdn
path: root-cdn.zip
retention-days: 1
compression-level: 0
- name: Upload root-metadata
uses: actions/[email protected]
with:
name: root-metadata
path: root-metadata.zip
retention-days: 1
compression-level: 0
- name: Upload root-metadata
uses: actions/[email protected]
with:
name: gameimages
path: gameimages.zip
retention-days: 1
compression-level: 0
- name: Upload indexes_hi3
uses: actions/[email protected]
with:
name: indexes_hi3
path: indexes_hi3.zip
retention-days: 1
compression-level: 0
- name: Upload indexes_hsr
uses: actions/[email protected]
with:
name: indexes_hsr
path: indexes_hsr.zip
retention-days: 1
compression-level: 0
- name: Upload indexes_zzz
uses: actions/[email protected]
with:
name: indexes_zzz
path: indexes_zzz.zip
retention-days: 1
compression-level: 0
- name: Upload applyupdate
uses: actions/[email protected]
with:
name: applyupdate
path: applyupdate.zip
retention-days: 1
compression-level: 0
- name: Upload squirrel-stable
uses: actions/[email protected]
with:
name: squirrel-stable
path: squirrel-stable.zip
retention-days: 1
compression-level: 0
- name: Upload squirrel-preview
uses: actions/[email protected]
with:
name: squirrel-preview
path: squirrel-preview.zip
retention-days: 1
compression-level: 0
- name: Upload velopack-preview
uses: actions/[email protected]
with:
name: velopack-preview
path: velopack-preview.zip
retention-days: 1
compression-level: 0
- name: Upload velopack-stable
uses: actions/[email protected]
with:
name: velopack-stable
path: velopack-stable.zip
retention-days: 1
compression-level: 0
Sync-Root:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: root-cdn
- name: Extract Archive
run: unzip -qq root-cdn.zip -d root-cdn
- name: Sync Root Folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-cdn/cl-cdn/folderroot
destination-dir: cl-cdn
output-file-url: false
Sync-Metadata:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: root-metadata
- name: Extract Archive
run: |
unzip -qq root-metadata.zip -d root-metadata
- name: Sync Metadata root objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-root
destination-dir: cl-cdn/metadata
output-file-url: false
Sync-Images:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact (gameimages)
uses: actions/[email protected]
with:
name: gameimages
- name: Extract Archive
run: |
unzip -qq gameimages.zip -d root-metadata
- name: Sync Metadata logos objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-images/game_logos
destination-dir: cl-cdn/metadata/game_logos
output-file-url: false
- name: Sync Metadata posters objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-images/game_posters
destination-dir: cl-cdn/metadata/game_posters
output-file-url: false
- name: Sync Metadata steam-asset objects
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: root-metadata/cl-cdn/metadata/metadata-images/steam_assets
destination-dir: cl-cdn/metadata/steam_assets
output-file-url: false
Sync-Indexes-Hi3:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: indexes_hi3
- name: Extract Archive
run: |
unzip -qq indexes_hi3.zip -d indexes_hi3
- name: Sync Indexes
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: indexes_hi3/cl-cdn/metadata/repair_indexes
destination-dir: cl-cdn/metadata/repair_indexes
output-file-url: false
Sync-Indexes-HSR:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: indexes_hsr
- name: Extract Archive
run: |
unzip -qq indexes_hsr.zip -d indexes_hsr
- name: Sync Indexes
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: indexes_hsr/cl-cdn/metadata/repair_indexes
destination-dir: cl-cdn/metadata/repair_indexes
output-file-url: false
Sync-Indexes-ZZZ:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: indexes_zzz
- name: Extract Archive
run: |
unzip -qq indexes_zzz.zip -d indexes_zzz
- name: Sync Indexes
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: indexes_zzz/cl-cdn/metadata/repair_indexes
destination-dir: cl-cdn/metadata/repair_indexes
output-file-url: false
Sync-ApplyUpdate:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: applyupdate
- name: Extract Archive
run: unzip -qq applyupdate.zip -d applyupdate
- name: Sync ApplyUpdate-Preview
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: applyupdate/cl-cdn/applyupdate/preview
destination-dir: cl-cdn/preview
output-file-url: false
- name: Sync ApplyUpdate-stable
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: applyupdate/cl-cdn/applyupdate/stable
destination-dir: cl-cdn/stable
output-file-url: false
Sync-Squirrel-Stable:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: squirrel-stable
- name: Extract Archive
run: unzip -qq squirrel-stable.zip -d squirrel-stable
- name: Sync Squirrel\Stable folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: squirrel-stable/cl-cdn/squirrel/stable
destination-dir: cl-cdn/squirrel/stable
output-file-url: false
Sync-Squirrel-Preview:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: squirrel-preview
- name: Extract Archive
run: unzip -qq squirrel-preview.zip -d squirrel-preview
- name: Sync Squirrel\Preview folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: squirrel-preview/cl-cdn/squirrel/preview
destination-dir: cl-cdn/squirrel/preview
output-file-url: false
Sync-Velopack-Preview:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: velopack-preview
- name: Extract Archive
run: unzip -qq velopack-preview.zip -d velopack-preview
- name: Sync Velopack\Preview folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: velopack-preview/cl-cdn/velopack/preview
destination-dir: cl-cdn/velopack/preview
output-file-url: false
Sync-Velopack-Stable:
runs-on: ubuntu-latest
needs: Fetch
steps:
- name: Download Archive Artifact
uses: actions/[email protected]
with:
name: velopack-stable
- name: Extract Archive
run: unzip -qq velopack-stable.zip -d velopack-stable
- name: Sync Velopack\Stable folder
uses: ryand56/r2-upload-action@master
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: velopack-stable/cl-cdn/velopack/stable
destination-dir: cl-cdn/velopack/stable
output-file-url: false
Purge-Cache:
runs-on: ubuntu-latest
if: always() # always purge cache whenever it fails or succeed
needs: [Sync-Root, Sync-Metadata, Sync-Images, Sync-ApplyUpdate, Sync-Squirrel-Stable, Sync-Squirrel-Preview, Sync-Indexes-Hi3, Sync-Indexes-HSR, Sync-Indexes-ZZZ, Sync-Velopack-Preview]
steps:
- name: Purge Cloudflare cache
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_PURGE_CACHE_ZONEID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CF_PURGE_CACHE_TOKEN }}" \
-H "Content-Type: application/json" \
--data "{ \"purge_everything\": true }"