mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
name: Compile APK
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
FLUTTER_VERSION: "3.24.5"
|
|
RUST_VERSION: "1.82.0"
|
|
APK_BUILD_DIR: "/tmp/build"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
version: ${{ steps.get_version.outputs.version }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get version from pubspec.yaml
|
|
id: get_version
|
|
run: |
|
|
VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
build_apk:
|
|
needs: build
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Remove proprietary dependencies
|
|
run: sh scripts/remove_proprietary_dependencies.sh
|
|
|
|
- name: Copy files to env.APK_BUILD_DIR
|
|
run: |
|
|
mkdir -p $APK_BUILD_DIR
|
|
cp -r . $APK_BUILD_DIR
|
|
|
|
- name: Decode key.properties file
|
|
working-directory: ${{ env.APK_BUILD_DIR }}
|
|
env:
|
|
ENCODED_STRING: ${{ secrets.ANDROID_KEY_PROPERTIES }}
|
|
run: echo $ENCODED_STRING | base64 -di > app/android/key.properties
|
|
|
|
- name: Decode android-keystore.jks file
|
|
working-directory: ${{ env.APK_BUILD_DIR }}
|
|
env:
|
|
ENCODED_STRING: ${{ secrets.ANDROID_KEY_STORE }}
|
|
run: mkdir secrets && echo $ENCODED_STRING | base64 -di > secrets/android-keystore.jks
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Install Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: ${{ env.RUST_VERSION }}
|
|
|
|
- name: Dependencies
|
|
working-directory: ${{ env.APK_BUILD_DIR }}/app
|
|
run: flutter pub get
|
|
|
|
- name: Build APK
|
|
working-directory: ${{ env.APK_BUILD_DIR }}/app
|
|
run: flutter build apk --split-per-abi
|
|
|
|
- name: Upload APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: apk-result
|
|
path: |
|
|
${{ env.APK_BUILD_DIR }}/app/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
|
|
${{ env.APK_BUILD_DIR }}/app/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
|
${{ env.APK_BUILD_DIR }}/app/build/app/outputs/flutter-apk/app-x86_64-release.apk
|