Build Android (.apk(s)) #53
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
# Build fat apk and splitted apk(s) | |
name: Build Android (.apk(s)) | |
"on": | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
flutterChannel: | |
description: "Flutter channel" | |
default: stable | |
required: true | |
type: choice | |
options: | |
- stable | |
- beta | |
- master | |
jobs: | |
build_android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: ${{ inputs.flutterChannel }} | |
- name: Decoding android/key.properties | |
run: echo "${{ secrets.KEY_PROP }}" | base64 --decode > android/key.properties | |
- name: Decoding android/key.jks | |
run: echo "${{ secrets.KEY_JKS }}" | base64 --decode > android/key.jks | |
- name: Build splitted apk(s) | |
run: | | |
flutter pub get | |
flutter build apk --split-per-abi --release -v | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: splitted apk artifacts | |
path: build/app/outputs/apk/release/*.apk | |
- name: Upload artifacts (arm64-v8a) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: arm64-v8a artifact | |
path: build/app/outputs/apk/release/*-arm64-v8a-release.apk | |
- name: Upload artifacts (armeabi-v7a) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: armeabi-v7a artifact | |
path: build/app/outputs/apk/release/*-armeabi-v7a-release.apk | |
- name: Upload artifacts (x86_64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: x86_64 artifact | |
path: build/app/outputs/apk/release/*-x86_64-release.apk | |
# The previous apk will be deleted when re-running the flutter build apk again | |
# So we don't need to worry about the glob pattern for the fat apk | |
- name: Build fat apk | |
run: | | |
flutter pub get | |
flutter build apk --release | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fat apk artifact | |
path: build/app/outputs/apk/release/*.apk | |
- name: Write summary | |
run: | | |
echo ":blue_heart: Using **`flutter --version`**" >> $GITHUB_STEP_SUMMARY |