Skip to content

Build and deploy develop build for Android #283

Build and deploy develop build for Android

Build and deploy develop build for Android #283

name: deploy-develop-android
run-name: Build and deploy develop build for Android
on:
pull_request:
branches:
- 'ci/**'
push:
branches:
- "develop"
paths:
- ".github/**"
- "android/**"
- "lib/**"
- "pubspec.yaml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
environment: develop-android
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
with:
submodules: recursive
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e
with:
flutter-version: '3.29.2'
channel: 'stable'
cache: true
- name: install java (?)
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
with:
distribution: 'oracle'
java-version: '17'
- name: install ndk
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410
id: setup-ndk
with:
ndk-version: r27
link-to-sdk: true
local-cache: true
- name: load certificate
uses: mobiledevops/secret-to-file-action@be5f14e82c235ccde011f6ab0f6c984b35dc34c6
with:
base64-encoded-secret: ${{ secrets.APP_CERTIFICATE }}
filename: "keystore.jks"
working-directory: ./android/app
- name: create credentials
env:
keystore_pass: ${{ secrets.KEYSTORE_PASS }}
run: |
echo -e "storePassword: $keystore_pass\nkeyPassword: $keystore_pass\nkeyAlias: upload-unn-mobile\nstoreFile=keystore.jks\n" >> ./android/key.properties
- name: install firebase
run: curl -sL https://firebase.tools | bash
- name: get dependencies
run: flutter pub get
- name: configure flutterfire
env:
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
run: |
dart pub global activate flutterfire_cli 1.3.1
flutterfire configure -t $firebase_token -y -p unn-mobile-1 --platforms=android --android-package-name=ru.unn.unn_mobile
- name: build
run: flutter build apk
- name: delete old build artifact
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b
with:
name: unn-mobile.apk
- name: upload build artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: unn-mobile.apk
path: "build/app/outputs/flutter-apk/app-release.apk"
deploy:
runs-on: ubuntu-latest
environment: develop-android
needs: build
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- name: retrieve the binary
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
name: unn-mobile.apk
- name: install firebase
run: curl -sL https://firebase.tools | bash
- name: deploy (main)
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
env:
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
app_id: ${{ secrets.FIREBASE_A_APP_ID }}
run: |
firebase --project unn-mobile-1 --token $firebase_token appdistribution:distribute --groups "testers" --app "$app_id" --release-notes "$(git log -1 --pretty=%B)" "${GITHUB_WORKSPACE}/app-release.apk"
- name: deploy (PR)
if: github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/main'
env:
TITLE: ${{ github.head_ref || github.ref_name }}
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
app_id: ${{ secrets.FIREBASE_A_APP_ID }}
run: |
firebase --project unn-mobile-1 --token $firebase_token appdistribution:distribute --groups "testers" --app "$app_id" --release-notes "$TITLE" "${GITHUB_WORKSPACE}/app-release.apk"