feat/add-android-pipeline #6

Merged
malo merged 2 commits from feat/add-android-pipeline into main 2023-04-26 09:28:58 +00:00
6 changed files with 84 additions and 7 deletions

View File

@ -10,7 +10,7 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
fastlane add_plugin android_cd fastlane add_plugin android_cd
``` ```
## About android_cd ## About build_and_deploy
Google Play Store deployment plugin for Fastlane, simplifying the build and deployment process to internal, beta, alpha, and production channels, and promoting builds for testing. Google Play Store deployment plugin for Fastlane, simplifying the build and deployment process to internal, beta, alpha, and production channels, and promoting builds for testing.
@ -31,6 +31,7 @@ rake
``` ```
To automatically fix many of the styling issues, use To automatically fix many of the styling issues, use
``` ```
rubocop -a rubocop -a
``` ```

View File

@ -1,3 +1,3 @@
lane :test do lane :test do
android_cd(beta_type: "internal") build_and_deploy(beta_type: "internal")
end end

View File

@ -3,7 +3,7 @@ require_relative '../helper/android_cd_helper'
module Fastlane module Fastlane
module Actions module Actions
class AndroidCdAction < Action class BuildAndDeployAction < Action
def self.run(params) def self.run(params)
# Check parameters # Check parameters
unless Helper::AndroidCdHelper.is_set(params[:beta_type]) unless Helper::AndroidCdHelper.is_set(params[:beta_type])
@ -11,7 +11,7 @@ module Fastlane
puts("Error on beta type parameter") puts("Error on beta type parameter")
end 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 # Decrypt the keys archive and Extract the keys archive
Helper::AndroidCdHelper.decrypt_android_keys('.') Helper::AndroidCdHelper.decrypt_android_keys('.')
@ -59,7 +59,7 @@ module Fastlane
end end
def self.details 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 end
def self.available_options def self.available_options
@ -72,6 +72,7 @@ module Fastlane
end end
def self.is_supported?(platform) def self.is_supported?(platform)
# Restrict the use of the plugin to Android.
[:android].include?(platform) [:android].include?(platform)
end end
end end

View File

@ -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

View File

@ -21,6 +21,7 @@ module Fastlane
end end
end end
# Check if a parameter is set or not
def self.is_set(variable) def self.is_set(variable)
str_variable = variable str_variable = variable
str_variable = variable.strip if variable.class.to_s == "String" str_variable = variable.strip if variable.class.to_s == "String"

View File

@ -1,9 +1,9 @@
describe Fastlane::Actions::AndroidCdAction do describe Fastlane::Actions::BuildAndDeployAction do
describe '#run' do describe '#run' do
it 'prints a message' do it 'prints a message' do
expect(Fastlane::UI).to receive(:message).with("The android_cd plugin is working!") expect(Fastlane::UI).to receive(:message).with("The android_cd plugin is working!")
Fastlane::Actions::AndroidCdAction.run(nil) Fastlane::Actions::BuildAndDeployAction.run(nil)
end end
end end
end end