Build Flutter APK for all architectures #10
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 Flutter APK for all architectures | |
on: | |
workflow_dispatch | |
env: | |
FLUTTER_VERSION: "3.13.9" | |
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' 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: 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: '3.24.0' | |
- name: Dependencies | |
working-directory: ${{ env.APK_BUILD_DIR }} | |
run: flutter pub get | |
- name: Build APK | |
working-directory: ${{ env.APK_BUILD_DIR }} | |
run: flutter build apk --split-per-abi | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apk-result | |
path: | | |
${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-x86_64-release.apk |