ניסיון בניית apk על פעולות גיטאהב #5
Workflow file for this run
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 APK | |
on: | |
push: | |
branches: | |
- apk-build | |
jobs: | |
build-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' # Use Python 3.x | |
- name: Install system dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential zlib1g-dev libncurses5-dev libffi-dev libssl-dev | |
- name: Set up Java (for Android) | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '8' # Temurin 8 for sdkmanager | |
- name: Install Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24' # Or a specific version if required | |
channel: 'stable' | |
- name: Set Android SDK environment variables | |
run: | | |
echo "ANDROID_SDK_ROOT=$HOME/Android/Sdk" >> ~/.bashrc | |
echo "NDK_VERSION=25.2.9519653" >> ~/.bashrc | |
echo "SDK_VERSION=android-33" >> ~/.bashrc | |
echo "PATH=$ANDROID_SDK_ROOT/tools/bin:$PATH" >> ~/.bashrc | |
source ~/.bashrc | |
- 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 "ndk;$NDK_VERSION" --channel=3 | |
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "platforms;$SDK_VERSION" | |
- name: Create and activate virtual environment | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
- name: Install Flet and cython | |
run: | | |
python -m pip install --upgrade pip | |
pip install flet cython | |
pip install git+https://github.com/flet-dev/[email protected] # Install p4a from the correct branch | |
- name: Create Flet app | |
run: | | |
flet create my_flet_app | |
cd my_flet_app | |
- name: Build Python distribution for Android (if needed) | |
# This step is needed if your app relies on native Python libraries | |
# Adjust requirements as per your app's needs. | |
run: | | |
p4a create --requirements numpy --arch arm64-v8a --arch armeabi-v7a --arch x86_64 --sdk-dir $ANDROID_SDK_ROOT --ndk-dir $ANDROID_SDK_ROOT/ndk/$NDK_VERSION --dist-name mydist | |
echo "SERIOUS_PYTHON_P4A_DIST=$HOME/.python-for-android/dists/mydist" >> $GITHUB_ENV | |
- name: Build APK | |
run: | | |
flet publish --platforms android --android-signing-key-alias ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }} --android-signing-key-password ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }} --android-signing-store-password ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }} --android-signing-store-file ${{ secrets.ANDROID_SIGNING_STORE_FILE }} | |
- name: Upload APK as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: my_flet_app_apk | |
path: my_flet_app/dist/*.apk # Use wildcard to capture the correct APK name |