Skip to content

Commit 4ce8fd3

Browse files
authored
Add GitHub Actions workflow to build Android APK
1 parent 69de810 commit 4ce8fd3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/buildfix.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build Android APK
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 18
19+
20+
- name: Setup Java
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: 'temurin'
24+
java-version: 17
25+
26+
- name: Setup Android SDK
27+
uses: android-actions/setup-android@v3
28+
29+
# Install required NDK and CMake
30+
- name: Install NDK and CMake
31+
run: |
32+
sdkmanager "cmake;3.22.1" "ndk;26.1.10909125"
33+
34+
# Add swap space to prevent memory freeze
35+
- name: Increase swap space (4GB)
36+
run: |
37+
sudo fallocate -l 4G /swapfile
38+
sudo chmod 600 /swapfile
39+
sudo mkswap /swapfile
40+
sudo swapon /swapfile
41+
42+
- name: Cache Gradle and CMake
43+
uses: actions/cache@v4
44+
with:
45+
path: |
46+
~/.gradle/caches
47+
~/.gradle/wrapper
48+
android/.cxx
49+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/CMakeLists.txt') }}
50+
51+
- name: Install Expo CLI
52+
run: npm install -g expo
53+
54+
- name: Install Dependencies
55+
run: npm ci
56+
57+
- name: Verify environment variables
58+
run: echo "✅ Environment ready"
59+
60+
- name: Run Expo Prebuild (Android only)
61+
run: expo prebuild --platform android --clean
62+
63+
- name: Build Android APK
64+
working-directory: android
65+
env:
66+
ANDROID_NDK_HOME: ${{ env.ANDROID_SDK_ROOT }}/ndk/26.1.10909125
67+
CMAKE_VERSION: 3.22.1
68+
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs=-Xmx2048m"
69+
run: timeout 30m ./gradlew assembleRelease --no-daemon --info --stacktrace
70+
71+
- name: Upload APK Artifact
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: app-release.apk
75+
path: android/app/build/outputs/apk/release/app-release.apk

0 commit comments

Comments
 (0)