From 0d9ca892219ac4e320696eaacfb5d9e353cc2d16 Mon Sep 17 00:00:00 2001 From: micbakos-rdx Date: Tue, 23 May 2023 19:17:14 +0300 Subject: [PATCH] Fix problem that the fastlane-plugin-versioning_android plugin introduces This plugin is unable to read the version name when it is a variable. It reads it as a string. See this: https://github.com/beplus/fastlane-plugin-versioning_android/issues/7 --- Gemfile.lock | 2 ++ app/build.gradle | 8 ++++++-- fastlane/Fastfile | 4 ++-- fastlane/Pluginfile | 3 ++- fastlane/README.md | 8 ++++++++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3c8e922736..82c1e111fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,6 +106,7 @@ GEM xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) fastlane-plugin-firebase_app_distribution (0.3.8) + fastlane-plugin-json (1.1.0) fastlane-plugin-versioning_android (0.1.0) gh_inspector (1.1.3) google-apis-androidpublisher_v3 (0.31.0) @@ -218,6 +219,7 @@ PLATFORMS DEPENDENCIES fastlane fastlane-plugin-firebase_app_distribution + fastlane-plugin-json fastlane-plugin-versioning_android BUNDLED WITH diff --git a/app/build.gradle b/app/build.gradle index 6aeba3b6f3..21dd9b3d9d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,6 +14,10 @@ def debugPropertiesFile = rootProject.file("keystore-development.properties") def debugKeystoreProperties = new Properties() debugKeystoreProperties.load(new FileInputStream(debugPropertiesFile)) +static def getCommitHash() { + 'git rev-parse --verify --short HEAD'.execute().text.trim() +} + android { signingConfigs { debug { @@ -63,7 +67,7 @@ android { buildTypes { debug { testCoverageEnabled true - versionNameSuffix "-" + rootProject.ext.internalVersionName + versionNameSuffix "-" + rootProject.ext.internalVersionName + "-" + getCommitHash() resValue "string", "app_name", "Radix Wallet Dev" } debugAlpha { @@ -78,7 +82,7 @@ android { debugPreview { initWith release applicationIdSuffix ".preview" - versionNameSuffix "-" + rootProject.ext.internalVersionName + versionNameSuffix "-" + rootProject.ext.internalVersionName + "-" + getCommitHash() minifyEnabled true signingConfig signingConfigs.debugPreview resValue "string", "app_name", "Radix Wallet Preview" diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3533995a4d..3739659d5a 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -102,7 +102,7 @@ lane :release_to_google_play do skip_upload_screenshots: true, release_status: "draft", json_key: ENV["GOOGLE_PLAY_PREVIEW_DEPLOYER_JSON_FILE"] - ) + ) build_number_to_commit = File.read("../versioning/#{BUILD_NUMBER_FILE}") version_name = android_get_version_name @@ -146,4 +146,4 @@ lane :bump_build_number do |options| gradle_file: "app/build.gradle" ) -end \ No newline at end of file +end diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index e62baa988e..46a7a62d29 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -3,4 +3,5 @@ # Ensure this file is checked in to source control! gem 'fastlane-plugin-firebase_app_distribution' -gem 'fastlane-plugin-versioning_android' \ No newline at end of file +gem 'fastlane-plugin-versioning_android' +gem 'fastlane-plugin-json' diff --git a/fastlane/README.md b/fastlane/README.md index 192300f793..9b4e5d226c 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -45,6 +45,14 @@ Deploy to Google Play Console +### get_version_name + +```sh +[bundle exec] fastlane get_version_name +``` + + + ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.