🤖 Android Build #4
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: 🤖 Android Build | |
on: | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
android_build: | |
name: Build for Android | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Run shared environment setup steps | |
uses: ./.github/actions/environment-setup | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Create Android keystore file | |
run: | | |
echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" > android/release.keystore.asc | |
gpg -d --passphrase "${{secrets.ANDROID_RELEASE_KEYSTORE_ENCRYPTION_PASSPHRASE }}" --batch android/release.keystore.asc > android/release.keystore | |
- name: Create key.properties | |
run: | | |
echo "storeFile=release.keystore" >> android/key.properties | |
echo "storePassword=${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties | |
echo "keyPassword=${{ secrets.ANDROID_ALIAS_PW }}" >> android/key.properties | |
- name: Build App Bundle | |
run: >- | |
flutter build appbundle | |
--dart-define=IS_RELEASE=true | |
- name: Build APK | |
run: >- | |
flutter build apk | |
--dart-define=IS_RELEASE=true | |
- name: Upload AAB artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aab | |
path: build/app/outputs/bundle/release/app-release.aab | |
- name: Upload APK artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: apk | |
path: build/app/outputs/flutter-apk/app-release.apk | |
# F-Droid Build | |
- name: Override dependencies in pubspec.yaml to be FLOSS | |
run: | | |
yq -y -i '.dependency_overrides.geolocator_android.git = {"url": "https://github.com/Zverik/flutter-geolocator.git", "ref": "floss", "path": "geolocator_android"}' pubspec.yaml | |
- name: Download pub dependencies | |
run: flutter pub get | |
- name: Build F-Droid APK | |
run: >- | |
flutter build apk | |
--dart-define=IS_RELEASE=true | |
# Required because F-Droid signs its apk with apksigner which produces a slightly different output than gradle signingConfig | |
# see: https://f-droid.org/docs/Reproducible_Builds/#reproducible-signatures | |
- name: Sign with apksigner | |
run: >- | |
$(find $ANDROID_SDK_ROOT/build-tools -name apksigner | sort -r | head -n 1) sign | |
--ks-key-alias ${{ secrets.ANDROID_KEY_ALIAS }} | |
--ks-pass pass:"${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" | |
--ks key.jks | |
build/app/outputs/flutter-apk/app-release.apk | |
- name: Upload F-Droid APK artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: apk-fdroid | |
path: build/app/outputs/flutter-apk/app-release.apk | |
# android_build: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - run: | | |
# echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" > android/release.keystore.asc | |
# gpg -d --passphrase "${{secrets.ANDROID_RELEASE_KEYSTORE_ENCRYPTION_PASSPHRASE }}" --batch android/release.keystore.asc > android/release.keystore | |
# - run: | | |
# echo "storeFile=release.keystore" >> android/key.properties | |
# echo "storePassword=${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" >> android/key.properties | |
# echo "keyAlias=upload" >> android/key.properties | |
# echo "keyPassword=${{ secrets.ANDROID_ALIAS_PW }}" >> android/key.properties | |
# - name: Setup secrets | |
# uses: ./.github/actions/add-secrets | |
# with: | |
# mapaccesstoken: ${{ secrets.MAPACCESSTOKEN }} | |
# - uses: actions/setup-java@v3 | |
# with: | |
# distribution: "zulu" | |
# java-version: "11" | |
# # - uses: nttld/setup-ndk@v1.0.6 | |
# # id: setup-ndk | |
# # with: | |
# # ndk-version: r21e | |
# # add-to-path: false | |
# - name: Setup flutter | |
# uses: ./.github/actions/flutter-version | |
# # - run: flutter upgrade | |
# - run: flutter pub get | |
# - name: generate isar files | |
# run: flutter pub run build_runner build --delete-conflicting-outputs | |
# - run: flutter build apk --release --verbose | |
# # env: | |
# # ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
# - run: flutter build appbundle --release #--flavor aab | |
# # env: | |
# # ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: android | |
# path: | | |
# build/app/outputs/flutter-apk/app-release.apk | |
# build/app/outputs/bundle/release/app-release.aab |