refactor: upadte native fastlane calls (#1 #2)

This commit is contained in:
Malo Léon 2023-04-27 14:23:12 +02:00
parent 89732f1f3f
commit f66ca731f8
6 changed files with 29 additions and 29 deletions

BIN
plugins/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -23,17 +23,17 @@ module Fastlane
build_number = Fastlane::Actions.number_of_commits
# Build the Android App Bundle
Fastlane::Actions.gradle(
task: "bundle",
build_type: "Release",
print_command: true,
properties: {
"android.injected.version.code" => build_number
}
)
Actions(GradleAction.run(
task: "bundle",
build_type: "Release",
print_command: true,
properties: {
"android.injected.version.code" => build_number
}
))
# Upload the Android App Bundle to the Play Store
Fastlane::Actions.upload_to_play_store(
Actions::UploadToPlayStoreAction.run(
track: params[:beta_type],
json_key: './service_account_key.json',
aab: '../build/app/outputs/bundle/release/app-release.aab',

View File

@ -24,7 +24,7 @@ module Fastlane
# Upload the Android App Bundle to the Play Store
Fastlane::Actions.upload_to_play_store(
track: params[:beta_type],
track: params[:from],
json_key: './service_account_key.json',
skip_upload_apk: true,
skip_upload_aab: true,

View File

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

View File

@ -22,10 +22,10 @@ module Fastlane
UI.message(creds.to_s)
# Ensure temporary keychain exists
Fastlane::Actions.ensure_temp_keychain(creds['temp_keychain_user'], creds['temp_keychain_password'])
Helper::IosCdHelper.ensure_temp_keychain(creds['temp_keychain_user'], creds['temp_keychain_password'])
# Obtain App Store Connect API key
api_key = Fastlane::Actions.app_store_connect_api_key(
api_key = Actions::AppStoreConnectApiKeyAction.run(
key_id: creds['apple_key_id'],
issuer_id: creds['apple_issuer_id'],
key_content: creds['apple_key_content'],
@ -34,13 +34,13 @@ module Fastlane
)
# Increment build number for latest TestFlight build
Fastlane::Actions.increment_build_number({
build_number: Fastlane::Actions.latest_testflight_build_number + 1,
Actions::IncrementBuildNumberAction.run({
build_number: Actions::LatestTestflightBuildNumberAction.run({}) + 1,
xcodeproj: "Runner.xcodeproj"
})
# Install Cocoapods
Fastlane::Actions.cocoapods(
Actions::CocoapodsAction.run(
clean_install: true
)
@ -49,7 +49,7 @@ module Fastlane
# The function takes the app's bundle identifier, an authorization token for the project's Git repository, and the name and password for a temporary keychain used to store the signing certificate.
# It uses the App Store Connect API key to access the App Store and increment the build number.
# It then runs `gym` to build and sign the app using the selected provisioning profile, and finally, uses `pilot` to upload the app to TestFlight for beta testing.
Fastlane::Actions.match(
Actions::MatchAction.run(
type: 'appstore',
app_identifier: creds['app_identifier_extensions'],
git_basic_authorization: Base64.strict_encode64(ENV["GIT_AUTHORIZATION"]),
@ -60,7 +60,7 @@ module Fastlane
# Build and export app using Gym
# Builds and packages an iOS app or framework for distribution to the App Store, TestFlight, or Enterprise distribution.
Fastlane::Actions.gym(
Actions::GymAction.run(
configuration: "Release",
workspace: "Runner.xcworkspace",
scheme: "your_schema",
@ -71,7 +71,7 @@ module Fastlane
)
# Upload build to App Store Connect using Pilot
Fastlane::Actions.pilot(
Actions::PilotAction.run(
apple_id: creds['developer_app_id'].to_s,
app_identifier: creds['developer_app_identifier'].to_s,
skip_waiting_for_build_processing: true,
@ -81,7 +81,7 @@ module Fastlane
ipa: "./Runner.ipa"
)
Fastlane::Actions.delete_temp_keychain
Actions::DeleteTempKeychainAction.run
end
def self.description
@ -109,7 +109,7 @@ module Fastlane
end
def self.is_supported?(platform)
true
[:ios].include?(platform)
end
end
end

View File

@ -6,17 +6,17 @@ module Fastlane
module Helper
class IosCdHelper
# Define method to delete temporary keychain
def delete_temp_keychain(name)
def self.delete_temp_keychain(name)
if File.exist?(File.expand_path("~/Library/Keychains/#{name}-db"))
Fastlane::Actions.delete_keychain(
Actions::DeleteKeychainAction.run(
name: name
)
end
end
# Define method to create temporary keychain
def create_temp_keychain(name, password)
Fastlane::Actions.create_keychain(
def self.create_temp_keychain(name, password)
Actions::CreateKeychainAction.run(
name: name,
password: password,
unlock: false,
@ -25,7 +25,7 @@ module Fastlane
end
# Define method to ensure that temporary keychain exists
def ensure_temp_keychain(name, password)
def self.ensure_temp_keychain(name, password)
delete_temp_keychain(name)
create_temp_keychain(name, password)
end
@ -40,7 +40,8 @@ module Fastlane
# Decrypts ios credentials
def self.decrypt_ios_keys(ios_directory)
# Define the GPG command with options
gpg_command = "gpg --quiet --batch --yes --decrypt --passphrase=#{ENV['IOS_KEYS_SECRET_PASSPHRASE']} \
# gpg_command = "gpg --quiet --batch --yes --decrypt --passphrase=#{ENV['IOS_KEYS_SECRET_PASSPHRASE']} \
gpg_command = "gpg --quiet --batch --yes --decrypt --passphrase=toto1234 \
--output #{ios_directory}/ios_keys.zip #{ios_directory}/ios_keys.zip.gpg"
# Execute the GPG command using system
@ -48,9 +49,8 @@ module Fastlane
# Check if the command executed successfully
if $?.success?
# Move the extracted files to the current directory
`jar xvf #{ios_directory} && mv #{ios_directory}/ios_keys/* #{ios_directory}`
`jar xvf #{ios_directory}/ios_keys.zip && mv #{ios_directory}/ios_keys/* #{ios_directory}`
else
puts("Erreur lors de la décompression du fichier GPG")
end