diff --git a/android/app/build.gradle b/android/app/build.gradle index 6c91c85..53178d0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -13,12 +13,18 @@ if (flutterRoot == null) { def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { - flutterVersionCode = '1' + flutterVersionCode = '3' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { - flutterVersionName = '1.0' + flutterVersionName = '0.9.0' +} + +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } apply plugin: 'com.android.application' @@ -53,11 +59,27 @@ android { versionName flutterVersionName } + signingConfigs { + release { + if (System.getenv()["CI"]) { // CI=true is exported by Codemagic + storeFile file(System.getenv()["CM_KEYSTORE_PATH"]) + storePassword System.getenv()["CM_KEYSTORE_PASSWORD"] + keyAlias System.getenv()["CM_KEY_ALIAS"] + keyPassword System.getenv()["CM_KEY_PASSWORD"] + } else { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + } + buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.release } } } diff --git a/codemagic.yaml b/codemagic.yaml new file mode 100644 index 0000000..6c9b267 --- /dev/null +++ b/codemagic.yaml @@ -0,0 +1,50 @@ +workflows: + android-workflow: + name: Android Workflow + instance_type: mac_mini_m1 + max_build_duration: 120 + environment: + android_signing: + - codemagickeystore + groups: + - google_play # <-- (Includes GCLOUD_SERVICE_ACCOUNT_CREDENTIALS) + vars: + PACKAGE_NAME: "social.myportal.relatica" # <-- Put your package name here + GOOGLE_PLAY_TRACK: "internal" + flutter: stable + scripts: + - name: Set up local.properties + script: | + echo "flutter.sdk=$HOME/programs/flutter" > "$CM_BUILD_DIR/android/local.properties" + - name: Get Flutter packages + script: | + flutter packages pub get + # - name: Flutter analyze + # script: | + # flutter analyze + # ignore_failure: true + - name: Flutter unit tests + script: | + flutter test + ignore_failure: true + - name: Build AAB with Flutter + script: | + BUILD_NUMBER=$(($(google-play get-latest-build-number --package-name "$PACKAGE_NAME" --tracks="$GOOGLE_PLAY_TRACK") + 1)) + flutter build appbundle --release \ + --build-name=0.9.0 \ + --build-number=$PROJECT_BUILD_NUMBER + artifacts: + - build/**/outputs/**/*.aab + - build/**/outputs/**/mapping.txt + - flutter_drive.log + publishing: + email: + recipients: + - codemagic@myportal.social + notify: + success: true + failure: false + google_play: + credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS + track: $GOOGLE_PLAY_TRACK + submit_as_draft: true