diff --git a/Jenkinsfile b/Jenkinsfile index 56b2e7e..7c140d1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -209,7 +209,10 @@ if ( !lazyConfig.env.DRYRUN ) { withCredentials([file(credentialsId: env.GOOGLE_API_CID, variable: 'GOOGLE_API_FILE')]) { sh('cp $GOOGLE_API_FILE ~/GoogleAPICredentials.json') - fastLane('android', 'beta', '', 'rh-ruby24') + def currentVersion = androidVersion() + withEnv(["VERSION=${currentVersion.string}-${currentVersion.number}"],) { + fastLane('android', 'beta', '', 'rh-ruby24') + } } } }, @@ -256,7 +259,10 @@ if ( !lazyConfig.env.DRYRUN ) { withCredentials([file(credentialsId: env.GOOGLE_API_CID, variable: 'GOOGLE_API_FILE')]) { sh('cp $GOOGLE_API_FILE ~/GoogleAPICredentials.json') - fastLane('android', 'production', '', 'rh-ruby24') + def currentVersion = androidVersion() + withEnv(["VERSION=${currentVersion.string}-${currentVersion.number}"],) { + fastLane('android', 'production', '', 'rh-ruby24') + } } } }, diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5dd70b9..b1bd5e6 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -109,9 +109,16 @@ return get_application_id(getFlavorName(options)) end - # Extract VERSION_NUMBER from environment var named VERSION - def getVersionNumber(options = nil) - return ENV['VERSION'] ? ENV['VERSION'].split('-')[1] : nil + # Extract version_name from environment var named VERSION + def getVersionName(options = nil) + version_name = ENV['VERSION'] ? ENV['VERSION'].split('-')[0] : nil + return version_name + end + + # Extract version_code from environment var named VERSION + def getVersionCode(options = nil) + version_code = ENV['VERSION'] ? ENV['VERSION'].split('-')[1] : nil + return version_code end before_all do |lane, options| @@ -120,6 +127,8 @@ desc "Display infos about the app" lane :info do |options| + UI.message("App version name = #{getVersionName()}") + UI.message("App version number = #{getVersionCode()}") UI.message("App Flavor = #{getFlavorName(options)}") UI.message("App ID = #{getPackageName(options)}") end @@ -248,7 +257,7 @@ skip_upload_images: true, skip_upload_screenshots: true, package_name: "#{getPackageName(options)}", - version_code: getVersionNumber(), + version_code: getVersionCode(), ) end @@ -262,14 +271,10 @@ skip_upload_images: true, skip_upload_screenshots: true, package_name: "#{getPackageName(options)}", - version_code: getVersionNumber(), + version_code: getVersionCode(), ) end - lane :contest do |options| - UI.message("Version number = #{getVersionNumber()}") - end - # You can define as many lanes as you want after_all do |lane, options|