99 shouldUpload :
1010 required : true
1111 type : boolean
12- secrets :
13- USER :
14- required : true
15- PASSWORD :
16- required : true
17- PGP_SECRET :
18- required : true
19- PGP_PASSPHRASE :
20- required : true
2112
2213env :
23- RELEASE : ${{ inputs.isRelease }}
14+ CENTRAL_PORTAL_USERNAME : ${{ secrets.CENTRAL_PORTAL_USERNAME }}
15+ CENTRAL_PORTAL_PASSWORD : ${{ secrets.CENTRAL_PORTAL_PASSWORD }}
16+ SIGNING_KEY : ${{ secrets.PGP_SECRET }}
17+ SIGNING_PASSWORD : ${{ secrets.PGP_PASSPHRASE }}
2418
2519jobs :
26- build_Linux :
27- name : Build Windows/Linux
20+ build_windows :
21+ name : Build Windows
22+ runs-on : windows-latest
23+
24+ steps :
25+ - name : Cancel Previous Runs
26+ uses : styfle/cancel-workflow-action@0.12.1
27+ with :
28+ access_token : ${{ github.token }}
29+
30+ - name : Checkout code
31+ uses : actions/checkout@v4
32+
33+ - name : Set up JDK 17
34+ uses : actions/setup-java@v4
35+ with :
36+ distribution : " corretto"
37+ java-version : 17
38+
39+ - name : Set up MinGW
40+ uses : msys2/setup-msys2@v2
41+
42+ - name : Set up Developer Command Prompt
43+ uses : TheMrMilchmann/setup-msvc-dev@v3
44+ with :
45+ arch : x64
46+
47+ - name : Append the directory of 'vcvarsall.bat' to PATH environment variable
48+ uses : myci-actions/export-env-var-powershell@1
49+ with :
50+ name : PATH
51+ value : $env:PATH;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build
52+
53+ - name : Download sources
54+ run : ./gradlew :lua:lua-build:lua_download_source
55+
56+ - name : Build project
57+ run : ./gradlew :lua:lua-build:build_project_windows64
58+
59+ - name : Upload natives
60+ uses : actions/upload-artifact@v4
61+ with :
62+ name : windows-natives
63+ path : ./lua/lua-build/build/c++/libs/
64+ if-no-files-found : error
65+
66+ build_linux :
67+ name : Build Linux
68+ runs-on : ubuntu-22.04
69+
70+ steps :
71+ - name : Cancel Previous Runs
72+ uses : styfle/cancel-workflow-action@0.12.1
73+ with :
74+ access_token : ${{ github.token }}
75+
76+ - name : Checkout code
77+ uses : actions/checkout@v4
78+
79+ - name : Set up JDK 17
80+ uses : actions/setup-java@v4
81+ with :
82+ distribution : " corretto"
83+ java-version : 17
84+
85+ - name : Set up MinGW
86+ run : |
87+ sudo apt install -y --force-yes mingw-w64 lib32z1
88+
89+ - name : Change wrapper permissions
90+ run : chmod +x ./gradlew
91+
92+ - name : Download sources
93+ run : ./gradlew :lua:lua-build:lua_download_source
94+
95+ - name : Build project
96+ run : ./gradlew :lua:lua-build:build_project_linux64
97+
98+ - name : Upload natives
99+ uses : actions/upload-artifact@v4
100+ with :
101+ name : linux-natives
102+ path : ./lua/lua-build/build/c++/libs/
103+ if-no-files-found : error
104+
105+ build_mac :
106+ name : Build Mac
107+ runs-on : macos-latest
108+
109+ steps :
110+ - name : Cancel Previous Runs
111+ uses : styfle/cancel-workflow-action@0.12.1
112+ with :
113+ access_token : ${{ github.token }}
114+
115+ - name : Checkout code
116+ uses : actions/checkout@v4
117+
118+ - name : Set up JDK 17
119+ uses : actions/setup-java@v4
120+ with :
121+ distribution : " corretto"
122+ java-version : 17
123+
124+ - name : Change wrapper permissions
125+ run : chmod +x ./gradlew
126+
127+ - name : Download sources
128+ run : ./gradlew :lua:lua-build:lua_download_source
129+
130+ - name : Build project
131+ run : ./gradlew :lua:lua-build:build_project_mac64 :lua:lua-build:build_project_macArm
132+
133+ - name : Upload natives
134+ uses : actions/upload-artifact@v4
135+ with :
136+ name : mac-natives
137+ path : ./lua/lua-build/build/c++/libs/
138+ if-no-files-found : error
139+
140+ build_teavm :
141+ name : Build TeaVM
28142 runs-on : ubuntu-latest
29143
30144 steps :
31145 - name : Cancel Previous Runs
32- uses : styfle/cancel-workflow-action@0.12.0
146+ uses : styfle/cancel-workflow-action@0.12.1
33147 with :
34148 access_token : ${{ github.token }}
35149
36- - uses : actions/checkout@v3
150+ - name : Checkout code
151+ uses : actions/checkout@v4
37152
38- - name : Set up JDK 11
39- uses : actions/setup-java@v3
153+ - name : Set up JDK 17
154+ uses : actions/setup-java@v4
40155 with :
41- distribution : " zulu "
42- java-version : 11
156+ distribution : " corretto "
157+ java-version : 17
43158
44159 - name : Set up MinGW
45160 run : |
46161 sudo apt install -y --force-yes mingw-w64 lib32z1
47162
48163 - name : Install emscripten
49- uses : mymindstorm/setup-emsdk@v11
164+ uses : mymindstorm/setup-emsdk@v14
165+ with :
166+ version : 4.0.18
167+
168+ - name : Change wrapper permissions
169+ run : chmod +x ./gradlew
170+
171+ - name : Download sources
172+ run : ./gradlew :lua:lua-build:lua_download_source
173+
174+ - name : Build project
175+ run : ./gradlew :lua:lua-build:build_project_teavm
176+
177+ - name : Upload natives
178+ uses : actions/upload-artifact@v4
179+ with :
180+ name : teavm-natives
181+ path : ./lua/lua-build/build/c++/libs/
182+ if-no-files-found : error
183+
184+ build_android :
185+ name : Build Android
186+ runs-on : ubuntu-latest
187+
188+ steps :
189+ - name : Cancel Previous Runs
190+ uses : styfle/cancel-workflow-action@0.12.1
191+ with :
192+ access_token : ${{ github.token }}
193+
194+ - name : Checkout code
195+ uses : actions/checkout@v4
196+
197+ - name : Set up JDK 17
198+ uses : actions/setup-java@v4
199+ with :
200+ distribution : " corretto"
201+ java-version : 17
202+
203+ - name : Set up MinGW
204+ run : |
205+ sudo apt install -y --force-yes mingw-w64 lib32z1
50206
51207 - name : Install NDK
52208 id : setup-ndk
@@ -58,54 +214,140 @@ jobs:
58214 - name : Change wrapper permissions
59215 run : chmod +x ./gradlew
60216
61- - name : Download Lua source
62- run : ./gradlew :lua:lua-build:download_source
217+ - name : Download sources
218+ run : ./gradlew :lua:lua-build:lua_download_source
63219
64- - name : Build Lua
65- run : ./gradlew :lua:lua-build:build_project
220+ - name : Build project
221+ run : ./gradlew :lua:lua-build:build_project_android
66222 env :
67223 NDK_HOME : ${{ steps.setup-ndk.outputs.ndk-path }}
68224
69- - name : Upload Lua natives
70- uses : actions/upload-artifact@v3
225+ - name : Upload natives
226+ uses : actions/upload-artifact@v4
71227 with :
72- name : lua -natives
228+ name : android -natives
73229 path : ./lua/lua-build/build/c++/libs/
230+ if-no-files-found : error
74231
75- build_Mac :
76- name : Build Mac OS
77- runs-on : macos-11
78- needs : build_Linux
232+ upload_natives :
233+ name : Upload Natives
234+ needs : [build_windows, build_linux, build_mac, build_android, build_teavm]
235+ runs-on : ubuntu-latest
79236
80237 steps :
81- - uses : actions/checkout@v3
238+ - name : Cancel Previous Runs
239+ uses : styfle/cancel-workflow-action@0.12.1
240+ with :
241+ access_token : ${{ github.token }}
242+
243+ - name : Checkout code
244+ uses : actions/checkout@v4
82245
83- - name : Set up JDK 11
84- uses : actions/setup-java@v2
246+ - name : Get version
247+ uses : madhead/read-java-properties@latest
248+ id : version
85249 with :
86- distribution : " zulu"
87- java-version : 11
250+ file : " ./gradle.properties"
251+ property : version
252+ default : 0.0.1
88253
89- - name : Download lua natives natives
90- uses : actions/download-artifact@v3
254+ - name : Set up JDK 17
255+ uses : actions/setup-java@v4
91256 with :
92- name : lua-natives
93- path : ./lua/lua-build/build/c++/libs/
257+ distribution : " corretto"
258+ java-version : 17
259+
260+ - name : Set up MinGW
261+ run : |
262+ sudo apt install -y --force-yes mingw-w64 lib32z1
94263
95264 - name : Change wrapper permissions
96265 run : chmod +x ./gradlew
97266
98- - name : Download Lua source
99- run : ./gradlew :lua:lua-build:download_source
267+ - name : Download windows natives
268+ uses : actions/download-artifact@v4
269+ with :
270+ name : windows-natives
271+ path : ./lua/lua-build/build/c++/libs/
272+
273+ - name : Download linux natives
274+ uses : actions/download-artifact@v4
275+ with :
276+ name : linux-natives
277+ path : ./lua/lua-build/build/c++/libs/
278+
279+ - name : Download mac natives
280+ uses : actions/download-artifact@v4
281+ with :
282+ name : mac-natives
283+ path : ./lua/lua-build/build/c++/libs/
284+
285+ - name : Download android natives
286+ uses : actions/download-artifact@v4
287+ with :
288+ name : android-natives
289+ path : ./lua/lua-build/build/c++/libs/
290+
291+ - name : Download teavm natives
292+ uses : actions/download-artifact@v4
293+ with :
294+ name : teavm-natives
295+ path : ./lua/lua-build/build/c++/libs/
296+
297+ - name : Delete generated files
298+ run : |
299+ rm -rf lua/lua-core/src/main/java/*
300+ rm -rf lua/lua-teavm/src/main/java/*
301+ echo "Deleted generated files"
100302
101- - name : Build Lua
303+ - name : Generate Lua classes
102304 run : ./gradlew :lua:lua-build:build_project
103305
104- - name : Upload to repository
306+ - name : Configure Git
307+ run : |
308+ git config user.name "GitHub Actions Bot"
309+ git config user.email "bot@github.com"
310+
311+ - name : Commit generated code
105312 if : ${{ inputs.shouldUpload }}
106- run : ./gradlew publish
107- env :
108- USER : ${{ secrets.USER }}
109- PASSWORD : ${{ secrets.PASSWORD }}
110- SIGNING_KEY : ${{ secrets.PGP_SECRET }}
111- SIGNING_PASSWORD : ${{ secrets.PGP_PASSPHRASE }}
313+ run : |
314+ git add .
315+ git commit -m "Commit generated code" || echo "No changes to commit"
316+ git push origin HEAD
317+
318+ - name : Upload Release to repository
319+ uses : nick-fields/retry@v3
320+ if : ${{ inputs.shouldUpload && inputs.isRelease }}
321+ with :
322+ max_attempts : 3
323+ timeout_minutes : 10
324+ retry_on : error
325+ command : ./gradlew publishRelease
326+
327+ - name : Upload Snapshot to repository
328+ uses : nick-fields/retry@v3
329+ if : ${{ inputs.shouldUpload && !inputs.isRelease }}
330+ with :
331+ max_attempts : 3
332+ timeout_minutes : 10
333+ retry_on : error
334+ command : ./gradlew publishSnapshot
335+
336+ - name : Create Git tag
337+ uses : actions/github-script@v7
338+ if : ${{ inputs.isRelease }}
339+ with :
340+ script : |
341+ const versionOutputs = ${{ toJSON(steps.version.outputs) }};
342+
343+ var version = versionOutputs.value;
344+
345+ console.log("Version: " + version);
346+
347+ var ref = "refs/tags/" + version
348+ github.rest.git.createRef({
349+ owner: context.repo.owner,
350+ repo: context.repo.repo,
351+ ref: ref,
352+ sha: context.sha
353+ });
0 commit comments