Update build-apk.yml #2
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 Flet Android APK | |
on: | |
push: | |
branches: | |
- flet-build | |
paths: | |
- '.github/workflows/build-apk.yml' | |
jobs: | |
build-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential zlib1g-dev libncurses5-dev libffi-dev libssl-dev unzip | |
- name: Set up Java (for Android) | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Install Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24' | |
channel: 'stable' | |
- name: Download and Install Android Command Line Tools | |
run: | | |
mkdir -p $HOME/Android/cmdline-tools | |
cd $HOME/Android/cmdline-tools | |
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O cmdline-tools.zip | |
unzip cmdline-tools.zip | |
mv cmdline-tools $HOME/Android/cmdline-tools/latest | |
echo "ANDROID_SDK_ROOT=$HOME/Android" >> $GITHUB_ENV | |
echo "PATH=$PATH:$HOME/Android/cmdline-tools/latest/bin" >> $GITHUB_ENV | |
echo "PATH=$PATH:$HOME/Android/tools/bin" >> $GITHUB_ENV | |
- name: Accept Android SDK licenses | |
run: yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses | |
- name: Install Android SDK components | |
run: | | |
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-35" "build-tools;34.0.0" "ndk;27.2.12479018" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install cython | |
- name: Build APK | |
run: | | |
flet build apk --output build/apk -v | |
env: | |
PYTHONIOENCODING: utf-8 | |
PYTHONUTF8: 1 | |
- name: Upload APK as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: shamor_vezachor_apk | |
path: build/apk/*.apk |