diff --git a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy_action.rb b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy_action.rb index 5236d35..316ab0e 100644 --- a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy_action.rb +++ b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/build_and_deploy_action.rb @@ -11,7 +11,7 @@ module Fastlane puts("Error on beta type parameter") end - UI.message("Building and deploying to Google Play Store in #{params[:beta_type]}") + UI.message("⌛️ Building and deploying to Google Play Store in #{params[:beta_type]}..") # Decrypt the keys archive and Extract the keys archive Helper::AndroidCdHelper.decrypt_android_keys('.') @@ -59,7 +59,7 @@ module Fastlane end def self.details - "The Fastlane Google Play Store deployment plugin streamlines the build and deployment process to internal, beta, alpha, and production channels, simplifying the process of distributing builds for testing. With its advanced promotion functionality, it also enables easy promotion of builds to higher beta testing phases, helping you get your app to market faster." + "The Fastlane Google Play Store deployment action streamlines the build and deployment process to internal, beta, alpha, and production channels, simplifying the process of distributing builds for testing. With its advanced promotion functionality, it also enables easy promotion of builds to higher beta testing phases, helping you get your app to market faster." end def self.available_options @@ -72,6 +72,7 @@ module Fastlane end def self.is_supported?(platform) + # Restrict the use of the plugin to Android. [:android].include?(platform) end end diff --git a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/promote_action.rb b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/promote_action.rb index e69de29..6e7656b 100644 --- a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/promote_action.rb +++ b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/actions/promote_action.rb @@ -0,0 +1,74 @@ +require 'fastlane/action' +require_relative '../helper/android_cd_helper' + +module Fastlane + module Actions + class BuildAndDeployAction < Action + def self.run(params) + # Check from parameters + unless Helper::AndroidCdHelper.is_set(params[:from]) + UI.error("❌ Parameters from cannot be null") + puts("Error on beta type parameter") + end + + unless Helper::AndroidCdHelper.is_set(params[:destination]) + UI.error("❌ Parameters destination cannot be null") + puts("Error on beta type parameter") + end + + UI.message("⌛️ Promoting to Google Play Store from #{params[:from]} to #{params[:destination]}..") + + # Decrypt the keys archive and Extract the keys archive + Helper::AndroidCdHelper.decrypt_android_keys('.') + + # Upload the Android App Bundle to the Play Store + Fastlane::Actions.upload_to_play_store( + track: params[:beta_type], + json_key: './service_account_key.json', + skip_upload_apk: true, + skip_upload_aab: true, + skip_upload_metadata: true, + skip_upload_changelogs: true, + skip_upload_images: true, + skip_upload_screenshots: true + ) + + UI.success('🍺 Successfully promote appbundle to Google Play Store') + end + + def self.description + "The Fastlane Google Play Store deployment action streamlines the build and deployment process to internal, beta, alpha, and production channels, simplifying the process of distributing builds for testing. With its advanced promotion functionality, it also enables easy promotion of builds to higher beta testing phases, helping you get your app to market faster." + end + + def self.authors + ["SAS Wyatt Studio"] + end + + def self.return_value + end + + def self.details + "The Fastlane Google Play Store deployment action to promote to internal, beta, alpha, and production channels, simplifying the process of distributing builds for testing." + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :from, + env_name: "ANDROID_CD_BETA_FROM", + optional: false, + description: "Actual deployed test (production, beta, alpha, internal)"), + + FastlaneCore::ConfigItem.new(key: :destination, + env_name: "ANDROID_CD_BETA_DESTINATION", + optional: false, + description: "Destination of test (production, beta, alpha, internal)") + ] + end + + def self.is_supported?(platform) + # Restrict the use of the plugin to Android. + [:android].include?(platform) + end + end + end +end diff --git a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb index 3aa310d..adb8c05 100644 --- a/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb +++ b/plugins/fastlane-plugin-android_cd/lib/fastlane/plugin/android_cd/helper/android_cd_helper.rb @@ -21,6 +21,7 @@ module Fastlane end end + # Check if a parameter is set or not def self.is_set(variable) str_variable = variable str_variable = variable.strip if variable.class.to_s == "String"