feat/add-android-pipeline #4

Merged
hugo merged 9 commits from feat/add-android-pipeline into main 2023-04-25 11:54:21 +00:00
3 changed files with 85 additions and 55 deletions
Showing only changes of commit a7052e57b5 - Show all commits

View File

@ -1,47 +0,0 @@
require 'fastlane/action'
require_relative '../helper/android_cd_helper'
module Fastlane
module Actions
class AndroidCdAction < Action
def self.run(params)
UI.message("The android_cd plugin is working!")
end
def self.description
"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."
end
def self.authors
["Malo Léon"]
end
def self.return_value
# If your method provides a return value, you can describe here what it does
end
def self.details
# Optional:
"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."
end
def self.available_options
[
# FastlaneCore::ConfigItem.new(key: :your_option,
# env_name: "ANDROID_CD_YOUR_OPTION",
# description: "A description of your option",
# optional: false,
# type: String)
]
end
def self.is_supported?(platform)
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
#
# [:ios, :mac, :android].include?(platform)
true
end
end
end
end

View File

@ -0,0 +1,67 @@
require 'fastlane/action'
require_relative '../helper/android_cd_helper'
module Fastlane
module Actions
class AndroidCdAction < Action
def self.run(params)
# Decrypt the keys archive and Extract the keys archive
Helper::AppcenterHelper.decrypt_android_keys('../')
# Clean the project before building
gradle(task: "clean")
# Set the build number based on the number of commits
build_number = number_of_commits()
# Build the Android App Bundle
gradle(
task: "bundle",
build_type: "Release",
print_command: true,
properties: {
"android.injected.version.code" => build_number,
}
)
# Upload the Android App Bundle to the Play Store
upload_to_play_store(
track: 'internal',
json_key: './service_account_key.json',
aab: '../build/app/outputs/bundle/release/app-release.aab',
skip_upload_metadata: true,
skip_upload_images: true,
skip_upload_screenshots: true,
release_status: "draft",
version_code: build_number,
package_name: 'com.jaggerlewis.jl_2022'
)
end
def self.description
"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."
end
def self.authors
["SAS Wyatt Studio"]
end
def self.return_value
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."
end
def self.available_options
[
]
end
def self.is_supported?(platform)
[:android].include?(platform)
end
end
end
end

View File

@ -1,15 +1,25 @@
require 'fastlane_core/ui/ui'
module Fastlane
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
module Helper
module Helper
class AndroidCdHelper
# class methods that you define here become available in your action
# as `Helper::AndroidCdHelper.your_method`
#
def self.show_message
UI.message("Hello from the android_cd plugin helper!")
def self.decrypt_android_keys(android_directory)
# Define the GPG command with options
gpg_command = "gpg --quiet --batch --yes --decrypt --passphrase=#{ENV['ANDROID_KEYS_SECRET_PASSPHRASE']} \
--output #{android_directory}/android_keys.zip #{android_directory}/android_keys.zip.gpg"
# Execute the GPG command using system
system(gpg_command)
# Check if the command executed successfully
if $?.success?
# Move the extracted files to the current directory
`jar xvf #{android_directory} && mv #{android_directory}/android_keys/* #{android_directory}`
else
puts "Erreur lors de la décompression du fichier GPG"
end
end
end
end