1+ name : Android Build
2+ on : workflow_dispatch
3+ jobs :
4+ build :
5+ name : Android Build
6+ permissions : write-all
7+ runs-on : ubuntu-latest
8+ steps :
9+ - name : Pulling the new commit
10+ uses : actions/checkout@v2
11+ - name : Setting up Haxe
12+ uses : krdlab/setup-haxe@v1
13+ with :
14+ haxe-version : 4.2.5
15+ - name : Setup Android NDK
16+ id : setup-ndk
17+ uses : nttld/setup-ndk@main
18+ with :
19+ ndk-version : r25c
20+ - name : Restore Previous Cache
21+ id : cache-debug-build-android-restore
22+ uses : actions/cache/restore@main
23+ with :
24+ path : |
25+ .haxelib/
26+ export/release/android/haxe/
27+ export/release/android/obj/
28+ key : cache-android-build
29+ - name : Installing/Updating libraries
30+ run : |
31+ haxe -cp commandline -D analyzer-optimize --run Main setup -s
32+ haxelib run lime rebuild hxcpp
33+
34+ - name : Configure Android
35+ run : |
36+ haxelib run lime setup -alias -y
37+ haxelib run lime config ANDROID_SDK $ANDROID_HOME
38+ haxelib run lime config ANDROID_NDK_ROOT $ANDROID_NDK_HOME
39+ haxelib run lime config JAVA_HOME $JAVA_HOME_17_X64
40+ haxelib run lime config ANDROID_SETUP true
41+ - name : Building the game
42+ run : |
43+ haxelib run lime build android -final
44+ - name : Clear Previous Cache
45+ uses : actions/github-script@main
46+ with :
47+ script : |
48+ try {
49+ const caches = await github.rest.actions.getActionsCacheList({
50+ owner: context.repo.owner,
51+ repo: context.repo.repo,
52+ })
53+ if (typeof caches.data.actions_caches != null && caches.data.actions_caches.length > 0) {
54+ for (const cache of caches.data.actions_caches) {
55+ if (cache.key == "cache-android-build") {
56+ console.log('Clearing ' + cache.key + '...')
57+ await github.rest.actions.deleteActionsCacheById({
58+ owner: context.repo.owner,
59+ repo: context.repo.repo,
60+ cache_id: cache.id,
61+ })
62+ console.log("Previous Cache Cleared!")
63+ }
64+ }
65+ }
66+ } catch (error) {
67+ console.log(error.message);
68+ }
69+ - name : Save Current Cache
70+ id : cache-release-build-android-save
71+ uses : actions/cache/save@main
72+ with :
73+ path : |
74+ .haxelib/
75+ export/release/android/haxe/
76+ export/release/android/obj/
77+ key : cache-android-build
78+ - name : Uploading artifact (entire build)
79+ uses : actions/upload-artifact@v4
80+ with :
81+ name : Codename Engine Android
82+ path : export/release/android/bin/app/build/outputs/apk/debug
0 commit comments