chore: upgrade Flutter #365
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 | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
flutter_version: '3.16.9' | |
jobs: | |
test-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Flutter environment | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.flutter_version }} | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Building generated source code | |
run: dart run build_runner build | |
- name: Analyze code | |
run: flutter analyze . | |
- name: Run tests | |
run: flutter test --no-pub -r expanded | |
- name: Build Android application (debug) | |
if: github.ref_type != 'tag' | |
run: flutter build appbundle --debug | |
- name: Prepare for release build | |
if: github.ref_type == 'tag' | |
env: | |
ENCRYPTED_FILE_KEY: ${{ secrets.ENCRYPTED_FILE_KEY }} | |
ENCRYPTED_FILE_IV: ${{ secrets.ENCRYPTED_FILE_IV }} | |
run: | | |
cd android | |
openssl aes-256-cbc -K $ENCRYPTED_FILE_KEY -iv $ENCRYPTED_FILE_IV -in fastlane/androidkey.jks.enc -out fastlane/androidkey.jks -d | |
- name: Build Android application (release) | |
if: github.ref_type == 'tag' | |
env: | |
RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
run: flutter build appbundle --release | |
- name: Upload release artifact for deploy | |
if: github.ref_type == 'tag' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: android-bundle-release | |
path: build/app/outputs/bundle/release/app-release.aab | |
deploy: | |
needs: test-build | |
if: github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download deploy artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: android-bundle-release | |
path: build/app/outputs/bundle/release | |
- name: Prepare for deploy | |
env: | |
ENCRYPTED_FILE_KEY: ${{ secrets.ENCRYPTED_FILE_KEY }} | |
ENCRYPTED_FILE_IV: ${{ secrets.ENCRYPTED_FILE_IV }} | |
run: | | |
cd android | |
openssl aes-256-cbc -K $ENCRYPTED_FILE_KEY -iv $ENCRYPTED_FILE_IV -in fastlane/googleplay-developer-key.json.enc -out fastlane/googleplay-developer-key.json -d | |
- name: Setup Ruby environment | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.6' | |
- name: Install Fastlane | |
run: gem install fastlane -N | |
- name: Deploy to Google Play | |
run: | | |
cd android | |
fastlane deploy_production |