-
Notifications
You must be signed in to change notification settings - Fork 42
440 lines (426 loc) · 18.7 KB
/
create_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
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
name: OoT3DR Builds
on:
workflow_dispatch:
inputs:
build_type:
description: 'Build type:'
required: true
type: choice
options:
- Nightly
- Release
version:
description: 'Release version: (For example: 3.2)'
required: false
jobs:
get-changelog:
name: Retrieve Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Get Last Nightly
id: nightly-version
run: |
echo "last_nightly=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
base-ref: ${{ env.last_nightly }}
outputs:
changelog: ${{ steps.changelog.outputs.changelog }}
last-nightly: ${{ env.last_nightly }}
build-cia-3dsx:
needs: get-changelog
name: Build CIA and 3DSX Files
runs-on: ubuntu-latest
container:
image: ghcr.io/z3dr/randotools:latest
steps:
- name: Checkout Project
uses: actions/[email protected]
- name: Run Build Script
run: |
chmod +x linux_build_rando.sh
./linux_build_rando.sh
- name: Get shorthand commit.
id: vars
run: echo "sha_short=$(echo ${{ github.sha }} | cut -c1-6)" >> $GITHUB_ENV
- if: ${{ github.event.inputs.build_type == 'Nightly' }}
name: Create Pre-release
uses: ncipollo/[email protected]
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "OoT3D_Randomizer.cia,OoT3D_Randomizer.3dsx,cia.png,3dsx.png"
prerelease: true
commit: "${{ github.sha }}"
tag: "Nightly-${{ env.sha_short }}"
name: "Nightly-${{ env.sha_short }}"
body: |
Please note that these are DEVELOPMENT builds and may not be entirely stable.
When reporting issues, please mention the six character commit listed in the randomizer menu.
You can use the FBI homebrew application to install the randomizer using either of these QR codes.
CIA QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/Nightly-${{ env.sha_short }}/cia.png)
3DSX QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/Nightly-${{ env.sha_short }}/3dsx.png)
Changes Since [${{ needs.get-changelog.outputs.last-nightly }}](https://github.com/${{ github.repository }}/releases/tag/${{ needs.get-changelog.outputs.last-nightly }}) 🛠:
${{ needs.get-changelog.outputs.changelog }}
- if: ${{ github.event.inputs.build_type == 'Release' }}
name: Create Release
uses: ncipollo/[email protected]
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "OoT3D_Randomizer.cia,OoT3D_Randomizer.3dsx,cia.png,3dsx.png"
prerelease: false
commit: "${{ github.sha }}"
tag: "v${{ github.event.inputs.version }}"
name: "v${{ github.event.inputs.version }}"
body: |
${{ github.event.inputs.version }} Changes:
- Please check back later for a full list of changes.
When reporting issues, please mention the six character commit listed in the randomizer menu.
You can use the FBI homebrew application to install the randomizer using either of these QR codes.
CIA QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/Nightly-${{ env.sha_short }}/cia.png)
3DSX QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/Nightly-${{ env.sha_short }}/3dsx.png)
deploy-gist:
needs: build-cia-3dsx
runs-on: ubuntu-latest
steps:
- name: Create basic JSON struct.
run: |
cat >> ./OoT3DR.unistore<< EOF
{
"storeContent": [
{
"info": {
"title": "OoT3D Randomizer <VERSION_STABLE>",
"author": "OoT3DR Team",
"description": "A randomizer patch for OoT3D to be used with Luma for Nintendo 3DS",
"category": [
"game patch"
],
"console": [
"3DS"
],
"icon_index": 2,
"sheet_index": 0,
"last_updated": "<VERSION_STABLE_MODIFIED> at <VERSION_STABLE_TIME> (UTC)",
"license": "MIT",
"version": "<VERSION_STABLE>"
},
"Download OoT3D_Randomizer.3dsx": [
{
"file": "https://github.com/gamestabled/Oot3d_randomizer/releases/latest/download/OoT3D_Randomizer.3dsx",
"message": "Downloading OoT3D_Randomizer_<VERSION_STABLE>.3dsx...",
"output": "%3DSX%/OoT3D_Randomizer_<VERSION_STABLE>.3dsx",
"type": "downloadFile"
}
],
"Download OoT3D_Randomizer.cia": [
{
"file": "https://github.com/gamestabled/Oot3d_randomizer/releases/latest/download/OoT3D_Randomizer.cia",
"message": "Downloading OoT3D_Randomizer_<VERSION_STABLE>.cia...",
"output": "sdmc:/OoT3D_Randomizer_<VERSION_STABLE>.cia",
"type": "downloadFile"
},
{
"file": "/OoT3D_Randomizer_<VERSION_STABLE>.cia",
"message": "Installing OoT3D_Randomizer_<VERSION_STABLE>.cia...",
"type": "installCia"
},
{
"file": "sdmc:/OoT3D_Randomizer_<VERSION_STABLE>.cia",
"message": "Deleting OoT3D_Randomizer_<VERSION_STABLE>.cia.",
"type": "deleteFile"
}
]
},
{
"info": {
"title": "OoT3D Randomizer Nightly <NIGHTLY_1>",
"author": "OoT3DR Team",
"description": "A randomizer patch for OoT3D to be used with Luma for Nintendo 3DS",
"category": [
"game patch"
],
"console": [
"3DS"
],
"icon_index": 1,
"sheet_index": 0,
"last_updated": "<NIGHTLY_1_CREATED> at <NIGHTLY_1_TIME> (UTC)",
"license": "MIT",
"version": "<NIGHTLY_1>"
},
"Download OoT3D_Randomizer.3dsx": [
{
"file": "<NIGHTLY_1_URL_3DSX>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_1>.3dsx...",
"output": "%3DSX%/OoT3D_Randomizer_<NIGHTLY_1>.3dsx",
"type": "downloadFile"
}
],
"Download OoT3D_Randomizer.cia": [
{
"file": "<NIGHTLY_1_URL_CIA>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_1>.cia...",
"output": "sdmc:/OoT3D_Randomizer_<NIGHTLY_1>.cia",
"type": "downloadFile"
},
{
"file": "/OoT3D_Randomizer_<NIGHTLY_1>.cia",
"message": "Installing OoT3D_Randomizer_<NIGHTLY_1>.cia...",
"type": "installCia"
},
{
"file": "sdmc:/OoT3D_Randomizer_<NIGHTLY_1>.cia",
"message": "Deleting OoT3D_Randomizer_<NIGHTLY_1>.cia.",
"type": "deleteFile"
}
]
},
{
"info": {
"title": "OoT3D Randomizer Nightly <NIGHTLY_2>",
"author": "OoT3DR Team",
"description": "A randomizer patch for OoT3D to be used with Luma for Nintendo 3DS",
"category": [
"game patch"
],
"console": [
"3DS"
],
"icon_index": 1,
"sheet_index": 0,
"last_updated": "<NIGHTLY_2_CREATED> at <NIGHTLY_2_TIME> (UTC)",
"license": "MIT",
"version": "<NIGHTLY_2>"
},
"Download OoT3D_Randomizer.3dsx": [
{
"file": "<NIGHTLY_2_URL_3DSX>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_2>.3dsx...",
"output": "%3DSX%/OoT3D_Randomizer_<NIGHTLY_2>.3dsx",
"type": "downloadFile"
}
],
"Download OoT3D_Randomizer.cia": [
{
"file": "<NIGHTLY_2_URL_CIA>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_2>.cia...",
"output": "sdmc:/OoT3D_Randomizer_<NIGHTLY_2>.cia",
"type": "downloadFile"
},
{
"file": "/OoT3D_Randomizer_<NIGHTLY_2>.cia",
"message": "Installing OoT3D_Randomizer_<NIGHTLY_2>.cia...",
"type": "installCia"
},
{
"file": "sdmc:/OoT3D_Randomizer_<NIGHTLY_2>.cia",
"message": "Deleting OoT3D_Randomizer_<NIGHTLY_2>.cia.",
"type": "deleteFile"
}
]
},
{
"info": {
"title": "OoT3D Randomizer Nightly <NIGHTLY_3>",
"author": "OoT3DR Team",
"description": "A randomizer patch for OoT3D to be used with Luma for Nintendo 3DS",
"category": [
"game patch"
],
"console": [
"3DS"
],
"icon_index": 1,
"sheet_index": 0,
"last_updated": "<NIGHTLY_3_CREATED> at <NIGHTLY_3_TIME> (UTC)",
"license": "MIT",
"version": "<NIGHTLY_3>"
},
"Download OoT3D_Randomizer.3dsx": [
{
"file": "<NIGHTLY_3_URL_3DSX>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_3>.3dsx...",
"output": "%3DSX%/OoT3D_Randomizer_<NIGHTLY_3>.3dsx",
"type": "downloadFile"
}
],
"Download OoT3D_Randomizer.cia": [
{
"file": "<NIGHTLY_3_URL_CIA>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_3>.cia...",
"output": "sdmc:/OoT3D_Randomizer_<NIGHTLY_3>.cia",
"type": "downloadFile"
},
{
"file": "/OoT3D_Randomizer_<NIGHTLY_3>.cia",
"message": "Installing OoT3D_Randomizer_<NIGHTLY_3>.cia...",
"type": "installCia"
},
{
"file": "sdmc:/OoT3D_Randomizer_<NIGHTLY_3>.cia",
"message": "Deleting OoT3D_Randomizer_<NIGHTLY_3>.cia.",
"type": "deleteFile"
}
]
},
{
"info": {
"title": "OoT3D Randomizer Nightly <NIGHTLY_4>",
"author": "OoT3DR Team",
"description": "A randomizer patch for OoT3D to be used with Luma for Nintendo 3DS",
"category": [
"game patch"
],
"console": [
"3DS"
],
"icon_index": 1,
"sheet_index": 0,
"last_updated": "<NIGHTLY_4_CREATED> at <NIGHTLY_4_TIME> (UTC)",
"license": "MIT",
"version": "<NIGHTLY_4>"
},
"Download OoT3D_Randomizer.3dsx": [
{
"file": "<NIGHTLY_4_URL_3DSX>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_4>.3dsx...",
"output": "%3DSX%/OoT3D_Randomizer_<NIGHTLY_4>.3dsx",
"type": "downloadFile"
}
],
"Download OoT3D_Randomizer.cia": [
{
"file": "<NIGHTLY_4_URL_CIA>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_4>.cia...",
"output": "sdmc:/OoT3D_Randomizer_<NIGHTLY_4>.cia",
"type": "downloadFile"
},
{
"file": "/OoT3D_Randomizer_<NIGHTLY_4>.cia",
"message": "Installing OoT3D_Randomizer_<NIGHTLY_4>.cia...",
"type": "installCia"
},
{
"file": "sdmc:/OoT3D_Randomizer_<NIGHTLY_4>.cia",
"message": "Deleting OoT3D_Randomizer_<NIGHTLY_4>.cia.",
"type": "deleteFile"
}
]
},
{
"info": {
"title": "OoT3D Randomizer Nightly <NIGHTLY_5>",
"author": "OoT3DR Team",
"description": "A randomizer patch for OoT3D to be used with Luma for Nintendo 3DS",
"category": [
"game patch"
],
"console": [
"3DS"
],
"icon_index": 1,
"sheet_index": 0,
"last_updated": "<NIGHTLY_5_CREATED> at <NIGHTLY_5_TIME> (UTC)",
"license": "MIT",
"version": "<NIGHTLY_5>"
},
"Download OoT3D_Randomizer.3dsx": [
{
"file": "<NIGHTLY_5_URL_3DSX>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_5>.3dsx...",
"output": "%3DSX%/OoT3D_Randomizer_<NIGHTLY_5>.3dsx",
"type": "downloadFile"
}
],
"Download OoT3D_Randomizer.cia": [
{
"file": "<NIGHTLY_5_URL_CIA>",
"message": "Downloading OoT3D_Randomizer_<NIGHTLY_5>.cia...",
"output": "sdmc:/OoT3D_Randomizer_<NIGHTLY_5>.cia",
"type": "downloadFile"
},
{
"file": "/OoT3D_Randomizer_<NIGHTLY_5>.cia",
"message": "Installing OoT3D_Randomizer_<NIGHTLY_5>.cia...",
"type": "installCia"
},
{
"file": "sdmc:/OoT3D_Randomizer_<NIGHTLY_5>.cia",
"message": "Deleting OoT3D_Randomizer_<NIGHTLY_5>.cia.",
"type": "deleteFile"
}
]
}
],
"storeInfo": {
"title": "OoT3D Randomizer",
"author": "OoT3DR Team",
"description": "OoT3D Randomizer - An online database of the most recent versions of the random experience for OoT3D",
"url": "http://tiny.cc/unistore",
"file": "Oot3DR.unistore",
"sheetURL": "https://dl.dropboxusercontent.com/s/5qv4ngozhgmyyen/OoT3DR.t3x?dl=1",
"sheet": "OoT3DR.t3x",
"bg_index": 1,
"bg_sheet": 0,
"revision": <REV_NUMBER>,
"version": 3
}
}
EOF
echo "Forgive me for this."
curl -sb -H "https://api.github.com/repos/gamestabled/OoT3D_Randomizer/releases" | jq '.[0:8] | .[].assets | .[3] | (.browser_download_url + " " +.created_at)' | grep "Nightly" | head -n 5 >> ciaDownloads.txt
curl -sb -H "https://api.github.com/repos/gamestabled/OoT3D_Randomizer/releases" | jq '.[0:8] | .[].assets | .[2] | (.browser_download_url + " " +.created_at)' | grep "Nightly" | head -n 5 >> 3dsxDownloads.txt
STABLEVERSION=`curl -sb -H "https://api.github.com/repos/gamestabled/OoT3D_Randomizer/releases/latest" | jq '.name'`
STABLEMODIFIED=`curl -sb -H "https://api.github.com/repos/gamestabled/OoT3D_Randomizer/releases/latest" | jq '.published_at'`
STABLEVERSION=`sed -e 's/^"//' -e 's/"$//' <<<"$STABLEVERSION"`
STABLEMODIFIED=`sed -e 's/^"//' -e 's/"$//' <<<"$STABLEMODIFIED"`
REVISION=`curl -Is -k "https://api.github.com/repos/gamestabled/OoT3D_Randomizer/commits?per_page=1" | sed -n '/^[Ll]ink:/ s/.*"next".*page=\([0-9]*\).*"last".*/\1/p'`
MODIFIED=$(echo ${STABLEMODIFIED} | cut -c1-10)
MODIFIED_DATE=$(echo ${STABLEMODIFIED} | cut -c12-19)
sed -i "s#<VERSION_STABLE>#${STABLEVERSION}#g" OoT3DR.unistore
sed -i "s#<VERSION_STABLE_MODIFIED>#$MODIFIED#g" OoT3DR.unistore
sed -i "s#<VERSION_STABLE_TIME>#$MODIFIED_DATE#g" OoT3DR.unistore
sed -i "s#<REV_NUMBER>#$REVISION#g" OoT3DR.unistore
LINES=$(cat ciaDownloads.txt)
LINENUM=1
IFS=$'\n'
for LINE in $LINES
do
LINE=`sed -e 's/^"//' -e 's/"$//' <<<"$LINE"`
ARRLINE=($(echo $LINE | tr " " "\n"))
sed -i "s#<NIGHTLY_${LINENUM}_URL_CIA>#${ARRLINE[0]}#g" OoT3DR.unistore
VERSION=$(echo ${ARRLINE[0]} | cut -c75-80)
MODIFIED=$(echo ${ARRLINE[1]} | cut -c1-10)
MODIFIED_DATE=$(echo ${ARRLINE[1]} | cut -c12-19)
sed -i "s#<NIGHTLY_$LINENUM>#$VERSION#g" OoT3DR.unistore
sed -i "s#<NIGHTLY_${LINENUM}_CREATED>#$MODIFIED#g" OoT3DR.unistore
sed -i "s#<NIGHTLY_${LINENUM}_TIME>#$MODIFIED_DATE#g" OoT3DR.unistore
LINENUM=`expr $LINENUM + 1`
done
LINES=$(cat 3dsxDownloads.txt)
LINENUM=1
for LINE in $LINES
do
LINE=`sed -e 's/^"//' -e 's/"$//' <<<"$LINE"`
ARRLINE=($(echo $LINE | tr " " "\n"))
sed -i "s#<NIGHTLY_${LINENUM}_URL_3DSX>#${ARRLINE[0]}#g" OoT3DR.unistore
LINENUM=`expr $LINENUM + 1`
done
- name: Deploy to Gist
uses: exuanbo/[email protected]
with:
token: ${{ secrets.TOKEN }}
gist_id: fa5ea9b42b99377c63bede1cf8ddfdad
gist_file_name: OoT3DR.unistore
file_path: ./OoT3DR.unistore