From f2db547d7831d0bd5c11204ce74f31f185b933c8 Mon Sep 17 00:00:00 2001 From: Manoj Malik Date: Tue, 8 Feb 2022 16:53:06 +0530 Subject: [PATCH] Added the support for submitting Android app bundle to Google Play (#5932) * Added the support for submitting Android app bundle to Google Play * Review fix: Added aab_filename instead of file_path in supply call --- fastlane/Fastfile | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 56ee9d43c..98a593995 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -708,10 +708,10 @@ platform :android do end lane :deploy do |options| - apk_path = options[:file] + file_path = options[:file] - unless apk_path.nil? - submit_to_google_play(apk_path) + unless file_path.nil? + submit_to_google_play(file_path) end end @@ -932,21 +932,34 @@ def submit_to_testflight(ipa_path) }) end -def submit_to_google_play(apk_path) - apks = Dir.glob(apk_path).select { |f| File.file? f} - filenames = apks.map {|f| File.basename(f)} - - if(apks.length > 0) +def submit_to_google_play(file_path) + if(file_path.include?("aab")) + aab_filename = Dir.glob(file_path).select { |f| File.file? f}.first unless ENV['SUPPLY_JSON_KEY'].nil? || ENV['SUPPLY_JSON_KEY'].empty? supply( package_name: ENV['MAIN_APP_IDENTIFIER'] || ENV['SUPPLY_PACKAGE_NAME'], track: ENV['SUPPLY_TRACK'] || 'alpha', - apk_paths: apks + aab: aab_filename, + skip_upload_apk: true ) end else - UI.user_error! "There are no apks in #{apk_path}" - return + apks = Dir.glob(file_path).select { |f| File.file? f} + filenames = apks.map {|f| File.basename(f)} + + if(apks.length > 0) + unless ENV['SUPPLY_JSON_KEY'].nil? || ENV['SUPPLY_JSON_KEY'].empty? + supply( + package_name: ENV['MAIN_APP_IDENTIFIER'] || ENV['SUPPLY_PACKAGE_NAME'], + track: ENV['SUPPLY_TRACK'] || 'alpha', + apk_paths: apks, + skip_upload_aab: true + ) + end + else + UI.user_error! "There are no apks in #{file_path}" + return + end end version_number = android_get_version_name(gradle_file: './android/app/build.gradle')