feat: Android APP V1 - Experimental Alpha
This commit is contained in:
73
.gitea/workflows/build-android-apk.yml
Normal file
73
.gitea/workflows/build-android-apk.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
name: Build Android APK
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
paths:
|
||||
- 'toju-app/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tools/build-android-apk.sh'
|
||||
- '.gitea/workflows/build-android-apk.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-android-apk:
|
||||
runs-on: ubuntu-latest
|
||||
container: node:22
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Restore npm cache
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: /root/.npm
|
||||
key: npm-android-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: npm-android-
|
||||
|
||||
- name: Restore Gradle cache
|
||||
uses: https://github.com/actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/root/.gradle/caches
|
||||
/root/.gradle/wrapper
|
||||
key: gradle-android-${{ hashFiles('toju-app/android/**/*.gradle*', 'toju-app/android/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
restore-keys: gradle-android-
|
||||
|
||||
- name: Install Android build toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends openjdk-21-jdk wget unzip
|
||||
|
||||
export ANDROID_SDK_ROOT=/opt/android-sdk
|
||||
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
|
||||
cd /tmp
|
||||
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
unzip -q commandlinetools-linux-11076708_latest.zip
|
||||
mv cmdline-tools "$ANDROID_SDK_ROOT/cmdline-tools/latest"
|
||||
export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools"
|
||||
|
||||
yes | sdkmanager --licenses >/dev/null
|
||||
sdkmanager "platform-tools" "platforms;android-36" "build-tools;35.0.0"
|
||||
|
||||
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> "$GITHUB_ENV"
|
||||
echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> "$GITHUB_ENV"
|
||||
echo "JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64" >> "$GITHUB_ENV"
|
||||
echo "PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_ENV: development
|
||||
run: npm ci
|
||||
|
||||
- name: Build debug APK
|
||||
run: bash tools/build-android-apk.sh
|
||||
|
||||
- name: Upload APK artifact
|
||||
uses: https://github.com/actions/upload-artifact@v4
|
||||
with:
|
||||
name: metoyou-android-debug-apk
|
||||
path: toju-app/android/app/build/outputs/apk/debug/app-debug.apk
|
||||
if-no-files-found: error
|
||||
Reference in New Issue
Block a user