diff --git a/.gitignore b/.gitignore index 250af94c..a3c9a5d2 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,4 @@ lint/reports/ .project .settings/ team/ +fastlane/metadata diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..7a118b49 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..da32fd58 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,178 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + atomos (0.1.3) + aws-eventstream (1.1.0) + aws-partitions (1.356.0) + aws-sdk-core (3.104.3) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.239.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1.0) + aws-sdk-kms (1.36.0) + aws-sdk-core (~> 3, >= 3.99.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.78.0) + aws-sdk-core (~> 3, >= 3.104.3) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.2.2) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.3) + claide (1.0.3) + colored (1.2) + colored2 (3.1.2) + commander-fastlane (4.4.6) + highline (~> 1.7.2) + declarative (0.0.20) + declarative-option (0.1.0) + digest-crc (0.6.1) + rake (~> 13.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.6) + emoji_regex (3.0.0) + excon (0.76.0) + faraday (1.0.1) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.6) + faraday (>= 0.7.4) + http-cookie (~> 1.0.0) + faraday_middleware (1.0.0) + faraday (~> 1.0) + fastimage (2.2.0) + fastlane (2.156.1) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.3, < 3.0.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander-fastlane (>= 4.4.6, < 5.0.0) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-api-client (>= 0.37.0, < 0.39.0) + google-cloud-storage (>= 1.15.0, < 2.0.0) + highline (>= 1.7.2, < 2.0.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (~> 2.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + slack-notifier (>= 2.0.0, < 3.0.0) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + gh_inspector (1.1.3) + google-api-client (0.38.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.9) + httpclient (>= 2.8.1, < 3.0) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.12) + google-cloud-core (1.5.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.3.3) + faraday (>= 0.17.3, < 2.0) + google-cloud-errors (1.0.1) + google-cloud-storage (1.27.0) + addressable (~> 2.5) + digest-crc (~> 0.4) + google-api-client (~> 0.33) + google-cloud-core (~> 1.2) + googleauth (~> 0.9) + mini_mime (~> 1.0) + googleauth (0.13.1) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.14) + highline (1.7.10) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.4.0) + json (2.3.1) + jwt (2.2.1) + memoist (0.16.2) + mini_magick (4.10.1) + mini_mime (1.0.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.0) + os (1.1.1) + plist (3.5.0) + public_suffix (4.0.5) + rake (13.0.1) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rouge (2.0.7) + rubyzip (2.3.0) + security (0.1.3) + signet (0.14.0) + addressable (~> 2.3) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + slack-notifier (2.3.2) + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.7) + unicode-display_width (1.7.0) + word_wrap (1.0.0) + xcodeproj (1.18.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.0) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.1.2 diff --git a/README.md b/README.md index 6cb02fbc..3709ef34 100644 --- a/README.md +++ b/README.md @@ -5,69 +5,15 @@ ## Getting Started -All configuration files are stored in the `$projectDir/team` folder which is ignored by git. -Contact [@george-lim](http://github.com/george-lim) for access to the team's existing configuration files. Alternatively, you may wish to create new configuration files for this project. +### Wiki -### Creating new configuration files -**NOTE: If you already have the configuration files, you may skip to the [installation](#installation) step** +Please refer to the [wiki](https://github.com/george-lim/bruno-android/wiki) before asking for help 🙏 [Coding and PR guidelines](https://github.com/george-lim/bruno-android/wiki/Coding-and-PR-guide) as well as the [deployment process](https://github.com/george-lim/bruno-android/wiki/Deployment-process) are documented there. In the future, complex team components and decisions will also be documented in the wiki. -1. Create a `team` folder in the project root directory and `cd` into it -2. Create `debug.keystore` by executing: -```bash -store_name='debug.keystore' -store_password='android' -key_alias='androiddebugkey' -key_password=$store_password +### Configuration -keytool -genkey -v -keystore $store_name -storepass $store_password -alias $key_alias -keypass $key_password -keyalg RSA -keysize 2048 -validity 100000 -dname "C=US, O=Android, CN=Android Debug" -``` -3. Create `release.keystore` by executing: -```bash -store_name='release.keystore' -store_password='********' -key_alias='androidreleasekey' -key_password=$store_password +Contact [@george-lim](http://github.com/george-lim) for access to the team's configuration files. Just copy the files to the `$projectDir/team` folder, and you are ready to go. The `team` folder is ignored by git. -keytool -genkey -v -keystore $store_name -storepass $store_password -alias $key_alias -keypass $key_password -keyalg RSA -keysize 2048 -validity 100000 -``` -4. Using variable values from step 2, create `debugConfig.gradle` using the following template: -```gradle -ext.debugConfig = [ - // Signing configuration keys - store_file: '../team/{store_name}', - store_password: {store_password}, - key_alias: {key_alias}, - key_password: {key_password}, - // Third-party secret keys - google_api_key: '', - spotify_client_id: '', - spotify_client_secret: '', - spotify_redirect_uri: '' -] -``` -5. Using variable values from step 3, create `releaseConfig.gradle` using the template from step 4 - -The following guides show how to create and add third-party secret keys to `debugConfig.gradle`. You may want to consider repeating certain steps to have different secret keys for `releaseConfig.gradle`. - -**Google Setup** -1. Create a new project on [Google Cloud](https://console.developers.google.com/projectcreate) -2. Enable [Maps SDK for Android](https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID) -3. Enable [Directions API](https://console.developers.google.com/apis/library/directions-backend.googleapis.com?q=Directions) -4. Create and [link a billing account](https://console.developers.google.com/billing/linkedaccount) -5. Create an [API key](https://console.developers.google.com/apis/credentials?authuser=1&project=bruno-286305&supportedpurview=project) -6. Restrict the API key to the two enabled APIs -7. Add the key to `google_api_key` in `debugConfig.gradle` - -**Spotify Setup** -1. Create a new application from the [Spotify developer dashboard](https://developer.spotify.com/dashboard/applications) -2. Find the client ID and add it to `spotify_client_id` in `debugConfig.gradle` -3. Find the client secret and add it to `spotify_client_secret` in `debugConfig.gradle` -4. From the dashboard, add the package name `com.bruno.android.dev` and the `debug.keystore` SHA1 fingerprint through the `edit settings` menu. Repeat this step for the package name `com.bruno.android` and the `release.keystore` SHA1 fingerprint. You can get the SHA1 fingerprint of a Keystore by executing: -``` -keytool -list -v -keystore {store_name} -storepass {store_password} -alias {key_alias} -keypass {key_password} -``` -5. From the dashboard, create a redirect URI through the `edit settings` menu -6. Add the URI to `spotify_redirect_uri` in `debugConfig.gradle` +You may also [create a new project configuration](https://github.com/george-lim/bruno-android/wiki/Creating-a-new-project-configuration). ### Installation diff --git a/app/build.gradle b/app/build.gradle index f42d241b..35ce1c24 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.application' -if (file('../team/debugConfig.gradle').exists()) { - apply from: '../team/debugConfig.gradle' +if (file('../team/debug-config.gradle').exists()) { + apply from: '../team/debug-config.gradle' } -if (file('../team/releaseConfig.gradle').exists()) { - apply from: '../team/releaseConfig.gradle' +if (file('../team/release-config.gradle').exists()) { + apply from: '../team/release-config.gradle' } boolean hasDebugConfig = project.hasProperty('debugConfig') @@ -38,7 +38,7 @@ android { applicationId "com.bruno.android" minSdkVersion 23 targetSdkVersion 30 - versionCode 1 + versionCode 2 versionName "1.0.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png deleted file mode 100644 index 64a0e616..00000000 Binary files a/app/src/main/ic_launcher-playstore.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index e9f7c0a2..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index c05b3e19..a96402f2 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 9bebba9b..00000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 846e0e84..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index 1f43daba..985a0124 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 38101a26..00000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 75e1c366..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index 5ef82e9c..91d32ce6 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 4c1f518f..00000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 50fb98a4..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index 97bfcdb3..99d47861 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 4e5f27bc..00000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index ce04291c..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index 4b6d7bce..89d1667a 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 218fd90a..00000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml index 949b7a93..c5d5899f 100644 --- a/app/src/main/res/values/ic_launcher_background.xml +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -1,4 +1,4 @@ - - - #F4A69B + + + #FFFFFF \ No newline at end of file diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 00000000..a5f7ce0e --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,2 @@ +json_key_file("team/service-account-key.json") +package_name("com.bruno.android") diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 00000000..70c7f850 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,119 @@ +opt_out_usage +update_fastlane + +default_platform(:android) + +platform :android do + def bump_version_code + build_gradle_path = '../app/build.gradle' + regex = /versionCode\s+(\d+)/ + + build_gradle_content = File.read(build_gradle_path) + version_code = build_gradle_content[regex, 1].to_i + build_gradle_content[regex, 1] = (version_code + 1).to_s + + build_gradle_file = File.new(build_gradle_path, 'w') + build_gradle_file.write(build_gradle_content) + build_gradle_file.close + end + + def bump_version_number(bump_type: nil, version_number: nil) + build_gradle_path = '../app/build.gradle' + regex = /versionName\s+("\d+.\d+.\d+")/ + + build_gradle_content = File.read(build_gradle_path) + version_name = build_gradle_content[regex, 1].gsub!('"','').split('.') + + major = version_name[0].to_i + minor = version_name[1].to_i + patch = version_name[2].to_i + + if bump_type == 'major' + major += 1 + minor = 0 + patch = 0 + elsif bump_type == 'minor' + minor += 1 + patch = 0 + elsif bump_type == 'patch' + patch += 1 + end + + if version_number + build_gradle_content[regex, 1] = "\"#{version_number}\"" + else + build_gradle_content[regex, 1] = "\"#{major}.#{minor}.#{patch}\"" + end + + build_gradle_file = File.new(build_gradle_path, 'w') + build_gradle_file.write(build_gradle_content) + build_gradle_file.close + end + + def bump_version(options) + if !options[:version] + bump_version_code + return + end + + version = options[:version] + regex = /\d+.\d+.\d+/ + version_number = version[regex, 0] + + if version_number + bump_version_code + bump_version_number(version_number: version_number) + elsif (version == 'major' || version == 'minor' || version == 'patch') + bump_version_code + bump_version_number(bump_type: version) + else + UI.user_error!('Unexpected user input!') + end + end + + def create_changelog + build_gradle_path = '../app/build.gradle' + regex = /versionCode\s+(\d+)/ + + build_gradle_content = File.read(build_gradle_path) + version_code = build_gradle_content[regex, 1] + changelog_path = '../fastlane/metadata/android/en-US/changelogs/' << version_code << '.txt' + + changelog_file = File.new(changelog_path, 'w') + changelog_file.write('• Bug fixes and performance improvements') + changelog_file.close + end + + def promote_latest_release + supply( + version_code: google_play_track_version_codes(track: 'internal')[0], + track: 'internal', + track_promote_to: 'production', + skip_upload_aab: true, + skip_upload_metadata: true, + skip_upload_changelogs: true, + skip_upload_images: true, + skip_upload_screenshots: true + ) + end + + # Optionally specify a version number (version:1.0.0) or version bump type (version:(major, minor, patch)) + # Defaults to a version code bump + desc 'Download metadata and binaries from Google Play' + lane :bump do |options| + download_from_play_store + bump_version(options) + create_changelog + end + + desc 'Release a new internal build to Google Play' + lane :release do + gradle(task: 'clean bundleRelease') + upload_to_play_store(track: 'internal') + end + + desc 'Promote latest internal build to production track' + lane :promote do + promote_latest_release + end +end diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 563ebc59..27d4ff41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Jun 23 16:36:02 EDT 2020 +#Mon Aug 17 23:05:48 EDT 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip