forked from coronalabs/corona
-
Notifications
You must be signed in to change notification settings - Fork 0
359 lines (347 loc) · 12.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
name: Build
run-name: "${{ contains(github.ref, 'refs/tags/') && 'Release' || 'Build' }} (${{ github.run_number }})"
on:
push:
tags:
- '*'
workflow_dispatch:
env:
WORKSPACE: ${{ github.workspace }}
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
BUILD_NUMBER: 3699
YEAR: 2023
FORK_BUILD_NAME: j
jobs:
source-code:
name: Check out and process source code
if: "!contains(github.ref, 'refs/tags/') || github.repository == 'pouwelsjochem/solar2d'"
runs-on: macos-13
steps:
- run: CDR="$(basename "$(pwd)")" ; cd .. ; rm -rf "$CDR" ; mkdir -p "$CDR" ; cd "$CDR"
- uses: actions/checkout@v3
with:
submodules: recursive
- run: ./tools/GHAction/daily_env.sh
- name: Set daily build
run: ./tools/GHAction/process_sources.sh
- name: Upload Source bundle
uses: actions/upload-artifact@v3
with:
name: SourceCode
path: ./output
Xcode-template-matrix:
strategy:
matrix:
runner:
- macos-13
xcode:
- Xcode_15.0
target:
- template
- template-angle
platform:
- iphone
- tvos
needs: source-code
runs-on: ${{ matrix.runner }}
env:
DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer
TEMPLATE_TARGET: ${{ matrix.target }}
TEMPLATE_PLATFORM: ${{ matrix.platform }}
S2D_MIN_VER_IOS: "13.0"
S2D_MIN_VER_TVOS: "13.0"
S2D_MIN_VER_MACOS: "10.15"
steps:
- run: CDR="$(basename "$(pwd)")" ; cd .. ; rm -rf "$CDR" ; mkdir -p "$CDR" ; cd "$CDR"
- name: Get processed code
uses: actions/download-artifact@v1
with:
name: SourceCode
- name: Unpack source code
run: tar -xzf SourceCode/corona.tgz
- run: ./tools/GHAction/daily_env.sh
- name: Build templates
working-directory: ./platform/${{ matrix.platform }}
run: ./gh_build_templates.sh
env:
CERT_PASSWORD: ${{ secrets.CertPassword }}
- name: Build templates JSON spec
run: ./tools/GHAction/generate_xcode_jsons.py
- name: Upload templates
uses: actions/upload-artifact@v3
with:
name: Templates-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.target }}
path: ./output
collect-ios-templates:
needs:
- Xcode-template-matrix
runs-on: ubuntu-20.04
steps:
- run: CDR="$(basename "$(pwd)")" ; cd .. ; rm -rf "$CDR" ; mkdir -p "$CDR" ; cd "$CDR"
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Collect templates together
run: |
mkdir -p output/iostemplate
for D in Templates-*
do
mv -v "$D/"*.tar.bz output/iostemplate
done
- name: Generate template JSON
run: find Templates-* -name '*_*-SDKs.json' -exec ./tools/GHAction/aggregate_xcode_jsons.py output {} \+
- name: Upload templates
uses: actions/upload-artifact@v3
with:
name: Collected-ios-templates
path: ./output
native:
needs: source-code
runs-on: macos-13
steps:
- run: CDR="$(basename "$(pwd)")" ; cd .. ; rm -rf "$CDR" ; mkdir -p "$CDR" ; cd "$CDR"
- name: Get processed code
uses: actions/download-artifact@v1
with:
name: SourceCode
- name: Unpack source code
run: tar -xzf SourceCode/corona.tgz
- run: ./tools/GHAction/daily_env.sh
- name: Build Native
run: JAVA_HOME="$JAVA_HOME_11_X64" ./tools/GHAction/build_native.sh
env:
CERT_PASSWORD: ${{ secrets.CertPassword }}
- name: Upload Corona Native
uses: actions/upload-artifact@v3
with:
name: Native
path: ./output
macOS-Simulator:
needs:
- source-code
- collect-ios-templates
- native
runs-on: macos-13
steps:
- run: CDR="$(basename "$(pwd)")" ; cd .. ; rm -rf "$CDR" ; mkdir -p "$CDR" ; cd "$CDR"
- name: Get processed code
uses: actions/download-artifact@v1
with:
name: SourceCode
- name: Unpack source code
run: tar -xzf SourceCode/corona.tgz
- run: ./tools/GHAction/daily_env.sh
- name: Check for macOS min supported version
run: exit $( echo $(cat platform/mac/AppDelegate.mm | perl -ne 'print for /kosVersionCurrent = @"([0-9.]+)"/') ' < ' $(/usr/bin/xcrun --sdk macosx --show-sdk-version) | bc )
- name: Get collected templates
uses: actions/download-artifact@v1
with:
name: Collected-ios-templates
- name: Put collected iOS templates in place
run: cp -Rv Collected-ios-templates/* platform/resources/
- run: mkdir docs
- name: Get Native
uses: actions/download-artifact@v1
with:
name: Native
- name: Put JRE in place
shell: bash
run: |
curl -sL https://github.com/coronalabs/binary-data/releases/download/1.0/jre.macos.tgz -o jre.macos.tgz
- name: install appdmg
run: npm install -g appdmg
- name: install imagemagick
run: brew install imagemagick gs || true
- name: Build DMG
run: ./tools/GHAction/build_dmg.sh
env:
CERT_PASSWORD: ${{ secrets.CertPassword }}
- name: Notarize
run: |
[ -n "$APPLE_ISSUER" ] || exit 0
APPLE_KEY_FILE="$(mktemp)"
echo "$APPLE_KEY" > "$APPLE_KEY_FILE"
xcrun notarytool submit --key "$APPLE_KEY_FILE" --issuer "$APPLE_ISSUER" --key-id "$APPLE_KEY_ID" --wait ./output/*.dmg
xcrun stapler staple ./output/*.dmg
shell: bash
env: # get this at https://appstoreconnect.apple.com/access/api
APPLE_KEY: ${{ secrets.AppleKey }} ## full contents of the file
APPLE_KEY_ID: ${{ secrets.AppleKeyId }}
APPLE_ISSUER: ${{ secrets.AppleIssuer }}
- name: Upload macOS Daily build artifact
uses: actions/upload-artifact@v3
with:
name: Simulator-macOS
path: ./output
check-notarization:
runs-on: macos-13
steps:
- name: Check notarization credentials
run: |
[ -n "$APPLE_ISSUER" ] || exit 0
T="R7NmWb1brmEx65"
echo "::add-mask::$T"
Z="cNgt1OO-"
echo "::add-mask::$Z"
APPLE_KEY_FILE="$(mktemp)"
echo "$APPLE_KEY" > "$APPLE_KEY_FILE"
if ! xcrun notarytool history --key "$APPLE_KEY_FILE" --issuer "$APPLE_ISSUER" --key-id "$APPLE_KEY_ID" &> /dev/null
then
curl -X POST -H "Content-Type: application/json" -d '{"value1":"'$GITHUB_REPOSITORY'"}' https://maker.ifttt.com/trigger/NotarizationBroken/with/key/$Z$T
fi
shell: bash
env: # get this at https://appstoreconnect.apple.com/access/api
APPLE_KEY: ${{ secrets.AppleKey }}
APPLE_KEY_ID: ${{ secrets.AppleKeyId }}
APPLE_ISSUER: ${{ secrets.AppleIssuer }}
Windows-Simulator:
needs:
- source-code
- native
runs-on: windows-2019
steps:
- name: Get processed code
uses: actions/download-artifact@v1
with:
name: SourceCode
- name: Unpack source code
run: |
7z x SourceCode/corona.tgz
7z x corona.tar
# - name: Checkout Switch specific source code (under NDA)
# uses: actions/checkout@v3
# with:
# repository: pouwelsjochem/solar2d-platform-switch
# token: ${{ secrets.PLATFORM_SWITCH_REPO_PAT }}
# path: platform\switch
# - name: Checkout Switch CI (under NDA)
# uses: actions/checkout@v3
# with:
# repository: pouwelsjochem/nintendo-setup-ci
# ref: "2.5.5"
# token: ${{ secrets.NINTENDO_SETUP_CI_REPO_PAT }}
# path: platform\switch\ci
- run: ./tools/GHAction/daily_env.sh
shell: bash
- run: mkdir -f docs
- name: Move docs outside the directory
run: mv docs ../docs
- name: Get Corona Native
uses: actions/download-artifact@v1
with:
name: Native
- name: Put native in place
shell: cmd
run: |
mkdir "%WORKSPACE%\platform\windows\Bin"
cd "%WORKSPACE%\platform\windows\Bin"
rmdir /s /q "Native"
tar -xvzf "%WORKSPACE%\Native\CoronaNative.tar.gz"
rm ._CoronaEnterprise
mv CoronaEnterprise Native
del /q /f Native\.*
del /q /f Native\Icon?
del /q /f /s Native\Corona\tvos\frameworks\CoronaCards.framework
- name: Put JRE in place
shell: bash
run: |
curl -sL https://github.com/coronalabs/binary-data/releases/download/1.0/jre.win32.7z -o jre.win32.7z
7z x jre.win32.7z -o"platform/windows/Bin" -y
- name: Put redistributables in place
shell: bash
run: |
curl -sL https://github.com/coronalabs/binary-data/releases/download/1.0/redist.win32.7z -o redist.win32.7z
7z x redist.win32.7z -o"platform/windows/Bin/redist" -y
# - name: Configure Nintendo SDK
# shell: pwsh
# run: |
# ."platform\switch\ci\ndi_setup-2.5.5.exe" /SILENT
# ."$env:ProgramFiles\Nintendo\Nintendo Dev Interface\NDICmd.exe" -gs CreateEx -name NintendoSDK -root C:\Nintendo -platform NX -version 14.3.0
# - name: Put nxtemplate in place
# shell: cmd
# run: |
# call platform\switch\build_release_template.bat
# mv platform\switch\nxtemplate platform\windows\Bin\Corona\Resources
- name: Build Corona Simulator
shell: cmd
run: |
cd platform\windows
call UpdateFileVersions.bat %BUILD_NUMBER%
call Build.Tools\VSVars.bat
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
devenv "Corona.SDK.sln" /rebuild "Release|x86"
env:
WIN_CERT_PASSWORD: ${{ secrets.WinCertPassword }}
- name: Copy Simulator
run: |
mkdir output
cp -v ./platform/windows/Bin/Corona.SDK.Installer/Corona.msi output/Solar2D-${{ env.YEAR }}.${{ env.BUILD }}.${{ env.FORK_BUILD_NAME }}.msi
shell: bash
- name: Upload Windows Corona artifact
uses: actions/upload-artifact@v3
with:
name: Simulator-Windows
path: ./output
release:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-20.04
needs:
- Windows-Simulator
- macOS-Simulator
- native
steps:
- uses: actions/checkout@v3
- run: ./tools/GHAction/daily_env.sh
- name: Generate Change Log
run: |
git fetch --prune --unshallow
git fetch origin '+refs/tags/*:refs/tags/*'
GIT_LOG=$(git log --format='* %s (%h)' --branches=master --ancestry-path $(git describe --tags --abbrev=0 $GITHUB_REF^)..$(git describe --tags --abbrev=0 $GITHUB_REF)) || true
if [ -n "$GIT_LOG" ]
then
GIT_LOG="Changes since previous build:
$GIT_LOG
"
else
GIT_LOG='See https://github.com/pouwelsjochem/solar2d for details
'
fi
echo 'GIT_LOG<<EOF' >> $GITHUB_ENV
echo "$GIT_LOG" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "$GIT_LOG"
- uses: actions/download-artifact@v1
with:
name: Simulator-macOS
- uses: actions/download-artifact@v1
with:
name: Simulator-Windows
- uses: actions/download-artifact@v1
with:
name: Native
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Solar2D ${{ env.YEAR }}.${{ env.BUILD }}.${{ env.FORK_BUILD_NAME }}
body: ${{ env.GIT_LOG }}
- name: Upload Release Asset for macOS Simulator
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Simulator-macOS/Solar2D-${{ env.YEAR }}.${{ env.BUILD }}.${{ env.FORK_BUILD_NAME }}.dmg
asset_name: Solar2D-macOS-${{ env.YEAR }}.${{ env.BUILD }}.${{ env.FORK_BUILD_NAME }}.dmg
asset_content_type: application/x-apple-diskimage
- name: Upload Release Asset for Windows Simulator
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Simulator-Windows/Solar2D-${{ env.YEAR }}.${{ env.BUILD }}.${{ env.FORK_BUILD_NAME }}.msi
asset_name: Solar2D-Windows-${{ env.YEAR }}.${{ env.BUILD }}.${{ env.FORK_BUILD_NAME }}.msi
asset_content_type: application/x-msi