From b6ccb570653d7c2469e149d0a9e56f6088a38a09 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 14 Feb 2021 23:13:08 +1100 Subject: [PATCH] Setup key signing --- .gitignore | 3 +++ RELEASE.md | 17 +++++++++++++++++ android/app/build.gradle | 18 ++++++++++++++++-- ios/Flutter/flutter_export_environment.sh | 4 ++-- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 RELEASE.md diff --git a/.gitignore b/.gitignore index 600c30a8..c8c53d7a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ # Sentry API key lib/dsn.dart +# App signing key +android/key.properties + # IntelliJ related *.iml *.ipr diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..8d15f102 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,17 @@ +# Release Process + +## Android Play Store + +[Reference](https://flutter.dev/docs/deployment/android#signing-the-app) + +### Key File + +Add a file `key.properties` under the android/ directory + +### Increment Build Number + +Make sure that the build number is incremented every time (or it will be rejected by Play Store). + +### Build Appbundle + +`flutter build appbundle` diff --git a/android/app/build.gradle b/android/app/build.gradle index 00005363..90858c7a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,12 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'kotlin-android' +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { compileSdkVersion 29 @@ -37,7 +43,6 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "inventree.inventree_app" minSdkVersion 25 targetSdkVersion 29 @@ -47,11 +52,20 @@ android { multiDexEnabled true } + signingConfigs { + release { + 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/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index ca64247b..d36a6600 100644 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -7,8 +7,8 @@ export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build\ios" export "OTHER_LDFLAGS=$(inherited) -framework Flutter" export "FLUTTER_FRAMEWORK_DIR=C:\flutter\bin\cache\artifacts\engine\ios" -export "FLUTTER_BUILD_NAME=1.0.0" -export "FLUTTER_BUILD_NUMBER=1" +export "FLUTTER_BUILD_NAME=0.1.0" +export "FLUTTER_BUILD_NUMBER=0.1.0" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=false" export "TREE_SHAKE_ICONS=false"