update love artifact #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and package for android | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v3 | |
with: | |
path: | | |
love-android | |
android-ndk-r21e | |
key: cache-deps | |
- name: Download NDK | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
wget https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip | |
7z x android-ndk-r21e-linux-x86_64.zip | |
- name: Add NDK to PATH | |
run: | | |
export ANDROID_NDK="$(realpath android-ndk-r21e)" | |
echo "NDK at: '$ANDROID_NDK'" | |
echo $ANDROID_NDK >> $GITHUB_PATH | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Install gcc-multilib | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib | |
- name: Setup love-android | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
git clone https://github.com/love2d/love-android --recursive -b 12.x | |
cd love-android | |
patch gradle.properties ../extra/android/app-data.patch | |
mkdir -p app/src/main/jniLibs | |
mkdir -p app/src/main/jniLibs/arm64-v8a | |
mkdir -p app/src/main/jniLibs/armeabi-v7a | |
mkdir -p app/src/main/jniLibs/x86 | |
mkdir -p app/src/main/jniLibs/x86_64 | |
mkdir -p app/src/embed/assets | |
cd .. | |
- name: Copy embedded App | |
run: | | |
cp -r *.lua assets compat extlibs game game_handler server ui input_schemes love-android/app/src/embed/assets | |
tree love-android/app/src/embed/assets | |
- name: Build sqlite3 | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
export ANDROID_NDK="$(realpath android-ndk-r21e)" | |
git clone https://github.com/stockrt/sqlite3-android | |
cd sqlite3-android | |
patch jni/Application.mk ../extra/android/sqlite_all_abi.patch | |
make | |
cd .. | |
mv sqlite3-android/libs/arm64-v8a/libsqlite3.so love-android/app/src/main/jniLibs/arm64-v8a | |
mv sqlite3-android/libs/armeabi-v7a/libsqlite3.so love-android/app/src/main/jniLibs/armeabi-v7a | |
mv sqlite3-android/libs/x86/libsqlite3.so love-android/app/src/main/jniLibs/x86 | |
mv sqlite3-android/libs/x86_64/libsqlite3.so love-android/app/src/main/jniLibs/x86_64 | |
- name: Build luv | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
export ANDROID_NDK="$(realpath android-ndk-r21e)" | |
./extra/android/build_luv.sh | |
- name: Assemble Debug APK | |
run: | | |
export ANDROID_NDK="$(realpath android-ndk-r21e)" | |
cd love-android | |
./gradlew assembleDebug --no-daemon | |
mv app/build/outputs/apk/embedNoRecord/debug/app-embed-noRecord-debug.apk ../oh3-debug.apk | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: oh3-debug.apk | |
path: oh3-debug.apk |