diff --git a/.gitignore b/.gitignore index 554d913..fe3227f 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,11 @@ flutter_export_environment.sh **/android/local.properties **/android/**/GeneratedPluginRegistrant.java **/android/**/gen/ +**/android/key.properties +**/android/fastlane/secrets/* +!**/android/fastlane/secrets/.gitkeep +**/android/fastlane/metadata/** +**/android/fastlane/report.* # iOS/XCode related **/ios/**/*.mode1v3 diff --git a/README.md b/README.md index 4d0baa3..1ad84de 100644 --- a/README.md +++ b/README.md @@ -81,11 +81,10 @@ different platforms. ##### Android -* Extract the encrypted ZIP file from `_secrets/` into the same folder with GPG. Ask for the password if necessary. * Copy `android/key.properties.example` to `android/key.properties` * Adjust properties matching your setup and folder structure -* Point to the `_secrets/key.jks` you just extracted and ask for the store password. -* Copy the `api-xxx.json` file into `android/fastlane/` +* Point to the `android/fastlane/secrets/key.jks` you just extracted and ask for the store password. +* Copy the `api-access.json` file into `android/fastlane/secrets/` ##### iOS diff --git a/android/Gemfile b/android/Gemfile new file mode 100644 index 0000000..7a118b4 --- /dev/null +++ b/android/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/android/app/build.gradle b/android/app/build.gradle index 6f71423..fc94482 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -24,6 +24,12 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { compileSdkVersion 29 @@ -40,12 +46,22 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - buildTypes { + signingConfigs { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + + buildTypes { + debug { signingConfig signingConfigs.debug } + release { + signingConfig signingConfigs.release + } } } diff --git a/android/fastlane/Appfile b/android/fastlane/Appfile new file mode 100644 index 0000000..bad438d --- /dev/null +++ b/android/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("fastlane/secrets/api-access.json") +package_name("de.varakh.fbmobile") \ No newline at end of file diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile new file mode 100644 index 0000000..2b94403 --- /dev/null +++ b/android/fastlane/Fastfile @@ -0,0 +1,20 @@ +default_platform(:android) + +platform :android do + desc "Build" + lane :build do + sh("#{ENV['PWD']}/fastlane/buildAndroid.sh") + end + + desc "Deploy a new version to the Google Play as Beta" + lane :beta do + build + upload_to_play_store(track: 'beta', aab: '../build/app/outputs/bundle/release/app-release.aab') + end + + desc "Deploy a new version to the Google Play" + lane :deploy do + build + upload_to_play_store(aab: '../build/app/outputs/bundle/release/app-release.aab') + end +end diff --git a/android/fastlane/README.md b/android/fastlane/README.md new file mode 100644 index 0000000..8ea746c --- /dev/null +++ b/android/fastlane/README.md @@ -0,0 +1,39 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew install fastlane` + +# Available Actions +## Android +### android build +``` +fastlane android build +``` +Build +### android beta +``` +fastlane android beta +``` +Deploy a new version to the Google Play as Beta +### android deploy +``` +fastlane android deploy +``` +Deploy a new version to the Google Play + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/android/fastlane/secrets/.gitkeep b/android/fastlane/secrets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/android/key.properties.example b/android/key.properties.example new file mode 100644 index 0000000..d52f7a4 --- /dev/null +++ b/android/key.properties.example @@ -0,0 +1,4 @@ +storePassword= +keyPassword= +keyAlias=key +storeFile=/absolute/path/to/git/android/fastlane/secrets/key.jks \ No newline at end of file