Build Android APKs #3
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 Android APKs | |
on: | |
workflow_dispatch: | |
jobs: | |
build_and_push: | |
name: Build and Push Android APKs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set version var | |
id: vars | |
run: | | |
sudo snap install yq | |
app_version=$(yq eval '.version' pubspec.yaml) | |
echo "app_version=$app_version" >> $GITHUB_OUTPUT | |
- name: Set up signing files | |
env: | |
APK_SIGN_PWD: "${{ secrets.APK_SIGN_PWD }}" | |
APK_SIGN_ALIAS: "${{ secrets.APK_SIGN_ALIAS }}" | |
APK_SIGN_JKS: "${{ secrets.APK_SIGN_JKS }}" | |
run: | | |
chmod a+x tools/generate_jks_linux_amd64 | |
tools/generate_jks_linux_amd64 | |
- name: Replace key | |
env: | |
SOME_SECRET_KEY: ${{ secrets.SOME_SECRET_KEY }} | |
SOME_REPLACE_KEY: ${{ secrets.SOME_REPLACE_KEY }} | |
SOME_REPLACE_FILE: ${{ secrets.SOME_REPLACE_FILE }} | |
run: | | |
chmod a+x tools/key_replace_linux_amd64 | |
tools/key_replace_linux_amd64 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- name: Build APK | |
run: flutter build apk --release | |
- name: Build APK (split per ABI) | |
run: flutter build apk --release --split-per-abi | |
- name: Rename APKs | |
run: | | |
mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_unknown.apk | |
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_armeabi-v7a.apk | |
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_arm64-v8a.apk | |
mv build/app/outputs/flutter-apk/app-x86_64-release.apk build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_x86_64.apk | |
- name: Upload APK (unknown) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppRhyme_android_unknown_${{ steps.vars.outputs.app_version }} | |
path: build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_unknown.apk | |
compression-level: 9 | |
- name: Upload APK (armeabi-v7a) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppRhyme_android_armeabi-v7a_${{ steps.vars.outputs.app_version }} | |
path: build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_armeabi-v7a.apk | |
compression-level: 9 | |
- name: Upload APK (arm64-v8a) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppRhyme_android_arm64-v8a_${{ steps.vars.outputs.app_version }} | |
path: build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_arm64-v8a.apk | |
compression-level: 9 | |
- name: Upload APK (x86_64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppRhyme_android_x86_64_${{ steps.vars.outputs.app_version }} | |
path: build/app/outputs/flutter-apk/AppRhyme_android_${{ steps.vars.outputs.app_version }}_x86_64.apk | |
compression-level: 9 |