Skip to content

Commit

Permalink
ניסיון בניית apk על פעולות גיטאהב
Browse files Browse the repository at this point in the history
  • Loading branch information
NHLOCAL committed Nov 24, 2024
1 parent 16ed001 commit 454d113
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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

0 comments on commit 454d113

Please sign in to comment.