Skip to content

March 2024 update (#69) #50

March 2024 update (#69)

March 2024 update (#69) #50

Workflow file for this run

name: Android CI Release
on:
push:
branches:
- master
tags:
- v*
env:
java_version: '11.0.14+9'
ruby_version: '2.7.2'
flutter_version: '3.19.3'
jobs:
android-internal:
name: Google Play internal
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read YAML Data
uses: KJ002/read-yaml@1.6
id: pubspec
with:
file: 'pubspec.yaml'
key-path: '["version"]'
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}
bundler-cache: true
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt-hotspot'
java-version: ${{ env.java_version }}
cache: 'gradle'
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.android/build-cache
/opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }}
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: ${{ env.flutter_version }}
- name: Flutter pub dependencies
run: flutter pub get
- name: Flutter add intl and run build_runner
run: |
flutter pub add intl_utils
flutter pub run intl_utils:generate
flutter pub run build_runner build
- name: Configure Keystore
env:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
run: |
mkdir -p ~/android
echo "$PRIVATE_KEY" > AN_key.p12.b64
base64 -d -i AN_key.p12.b64 > android/AN_key.p12
echo "storeFile=../AN_key.p12" >> android/key.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> android/key.properties
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> android/key.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> android/key.properties
- name: Create Google Play Config file
id: createServiceAccount
run: echo '${{ secrets.PLAY_STORE_KEY }}' > android/api-play-store-key.json
- name: Create Firebase Configuration Files forn Native / Flutter
env:
GOOGLE_SERVICES_ANDROID: ${{ secrets.GOOGLE_SERVICES_ANDROID_JSON }}
GOOGLE_SERVICES_IOS: ${{ secrets.GOOGLE_SERVICES_IOS_PLIST }}
FIREBASE_APP_ID_IOS: ${{ secrets.FIREBASE_APP_ID_IOS_JSON }}
FIREBASE_OPTIONS_DART: ${{ secrets.FIREBASE_OPTIONS_DART }}
run: |
echo Android google_services.json
echo "$GOOGLE_SERVICES_ANDROID" > google-services.json.b64
base64 -d -i google-services.json.b64 > android/app/google-services.json
echo iOS google_services.json
echo "$GOOGLE_SERVICES_IOS" > GoogleService-Info.plist.b64
base64 -d -i GoogleService-Info.plist.b64 > ios/Runner/GoogleService-Info.plist
echo iOS Firebase APP ID
echo "$FIREBASE_APP_ID_IOS" > firebase_app_id_file.json.b64
base64 -d -i firebase_app_id_file.json.b64 > ios/firebase_app_id_file.json
echo Firebase .dart file
echo "$FIREBASE_OPTIONS_DART" > FIREBASE_OPTIONS_DART.dart.b64
base64 -d -i FIREBASE_OPTIONS_DART.dart.b64 > lib/firebase_options.dart
- name: Build apk and appbundle
run: |
flutter build apk --no-pub --release --obfuscate --split-debug-info=build/app/outputs/apk-symbols/symbols
flutter build appbundle --no-pub --obfuscate --split-debug-info=build/app/outputs/aab-symbols/symbols
- name: Upload aab symbols to firebase
uses: w9jds/firebase-action@master
with:
args: crashlytics:symbols:upload --app=${{ secrets.FIREBASE_ANDROID_APP_ID }} build/app/outputs/aab-symbols/symbols
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
- name: Build appbundle and upload to google play
run: bundle exec fastlane android internal
- name: Create Github Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ steps.pubspec.outputs.data }}"
draft: true
prerelease: true
files: build/app/outputs/flutter-apk/app-release.apk