feat: Improved pipeline efficiency and adapted to new credentials template
This commit is contained in:
parent
b67a267ca5
commit
e003011b9a
@ -21,8 +21,20 @@ module Fastlane
|
|||||||
creds = Helper::IosCdHelper.parseIosCredentials('.')
|
creds = Helper::IosCdHelper.parseIosCredentials('.')
|
||||||
UI.message("👉🏼 Credentials parsed.")
|
UI.message("👉🏼 Credentials parsed.")
|
||||||
|
|
||||||
# Ensure temporary keychain exists
|
# Delete keychain if existing
|
||||||
Helper::IosCdHelper.ensure_temp_keychain(creds['temp_keychain_user'], creds['temp_keychain_password'])
|
if File.exist?(File.expand_path("~/Library/Keychains/#{name}-db"))
|
||||||
|
other_action.delete_keychain(
|
||||||
|
name: creds['temp_keychain_user'].to_s
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create keychain to store certifs
|
||||||
|
other_action.create_keychain(
|
||||||
|
name: creds['temp_keychain_user'].to_s,
|
||||||
|
password: creds['temp_keychain_password'].to_s,
|
||||||
|
unlock: false,
|
||||||
|
timeout: 0
|
||||||
|
)
|
||||||
UI.message("👉🏼 New keychain created")
|
UI.message("👉🏼 New keychain created")
|
||||||
|
|
||||||
# Obtain App Store Connect API key
|
# Obtain App Store Connect API key
|
||||||
@ -33,17 +45,16 @@ module Fastlane
|
|||||||
duration: 1200,
|
duration: 1200,
|
||||||
in_house: false
|
in_house: false
|
||||||
)
|
)
|
||||||
|
|
||||||
UI.message("👉🏼 API Key formated")
|
UI.message("👉🏼 API Key formated")
|
||||||
|
|
||||||
last_testflight_build_number =
|
last_testflight_build_number =
|
||||||
other_action.latest_testflight_build_number(
|
other_action.latest_testflight_build_number(
|
||||||
api_key: api_key,
|
api_key: api_key,
|
||||||
team_id: "118579280",
|
team_id: creds['team_id'].to_s,
|
||||||
team_name: "Jagger & Lewis",
|
team_name: creds['team_name'].to_s,
|
||||||
platform: 'ios',
|
platform: 'ios',
|
||||||
app_identifier: creds['developer_app_identifier'].to_s,
|
app_identifier: creds['developer_app_identifier'].to_s,
|
||||||
username: "leonmalo@sfr.fr"
|
username: creds['username'].to_s
|
||||||
) + 1
|
) + 1
|
||||||
|
|
||||||
# Increment build number for latest TestFlight build
|
# Increment build number for latest TestFlight build
|
||||||
@ -72,13 +83,13 @@ module Fastlane
|
|||||||
type: 'appstore',
|
type: 'appstore',
|
||||||
app_identifier: creds['app_identifier_extensions'],
|
app_identifier: creds['app_identifier_extensions'],
|
||||||
git_basic_authorization: Base64.strict_encode64(ENV["GIT_AUTHORIZATION"]),
|
git_basic_authorization: Base64.strict_encode64(ENV["GIT_AUTHORIZATION"]),
|
||||||
keychain_name: creds['temp_keychain_user'],
|
keychain_name: creds['temp_keychain_user'].to_s,
|
||||||
keychain_password: creds['temp_keychain_password'],
|
keychain_password: creds['temp_keychain_password'].to_s,
|
||||||
git_url: creds['git_url'],
|
git_url: creds['git_url'].to_s,
|
||||||
username: "leonmalo@sfr.fr",
|
username: creds['username'].to_s,
|
||||||
team_id: "118579280",
|
team_id: creds['team_id'].to_s,
|
||||||
team_name: "Jagger & Lewis",
|
team_name: creds['team_name'].to_s,
|
||||||
git_url: "https://github.com/JaggerLewis/jl2022_cert.git",
|
git_url: creds['git_url'].to_s,
|
||||||
storage_mode: "git"
|
storage_mode: "git"
|
||||||
)
|
)
|
||||||
UI.message("👉🏼 App signed")
|
UI.message("👉🏼 App signed")
|
||||||
@ -88,7 +99,6 @@ module Fastlane
|
|||||||
other_action.gym(
|
other_action.gym(
|
||||||
configuration: "Release",
|
configuration: "Release",
|
||||||
workspace: "Runner.xcworkspace",
|
workspace: "Runner.xcworkspace",
|
||||||
scheme: "your_schema",
|
|
||||||
export_method: "app-store",
|
export_method: "app-store",
|
||||||
export_options: {
|
export_options: {
|
||||||
provisioningProfiles: creds['provisioning_profiles']
|
provisioningProfiles: creds['provisioning_profiles']
|
||||||
@ -99,9 +109,6 @@ module Fastlane
|
|||||||
# Upload build to App Store Connect using Pilot
|
# Upload build to App Store Connect using Pilot
|
||||||
other_action.pilot(
|
other_action.pilot(
|
||||||
api_key: api_key,
|
api_key: api_key,
|
||||||
username: "leonmalo@sfr.fr",
|
|
||||||
team_id: "118579280",
|
|
||||||
team_name: "Jagger & Lewis",
|
|
||||||
apple_id: creds['developer_app_id'].to_s,
|
apple_id: creds['developer_app_id'].to_s,
|
||||||
app_identifier: creds['developer_app_identifier'].to_s,
|
app_identifier: creds['developer_app_identifier'].to_s,
|
||||||
skip_waiting_for_build_processing: true,
|
skip_waiting_for_build_processing: true,
|
||||||
@ -110,9 +117,13 @@ module Fastlane
|
|||||||
notify_external_testers: false,
|
notify_external_testers: false,
|
||||||
ipa: "./Runner.ipa"
|
ipa: "./Runner.ipa"
|
||||||
)
|
)
|
||||||
UI.message("👉🏼 App uploaded")
|
|
||||||
|
|
||||||
other_action.deleteTemp_keychain
|
# Delete keychain if existing
|
||||||
|
if File.exist?(File.expand_path("~/Library/Keychains/#{name}-db"))
|
||||||
|
other_action.delete_keychain(
|
||||||
|
name: creds['temp_keychain_user']
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.description
|
def self.description
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
require 'fastlane/action'
|
||||||
|
require_relative '../helper/ios_cd_helper'
|
||||||
|
|
||||||
|
module Fastlane
|
||||||
|
module Actions
|
||||||
|
class PromoteAction < Action
|
||||||
|
def self.run(params)
|
||||||
|
|
||||||
|
UI.message("⌛️ Promoting to Store in external test..")
|
||||||
|
|
||||||
|
# Decrypt the keys archive and Extract the keys archive
|
||||||
|
Helper::IosCdHelper.decrypt_ios_keys('.')
|
||||||
|
UI.message("👉🏼 Credentials decrypted.")
|
||||||
|
|
||||||
|
# Retrieve credentials
|
||||||
|
creds = Helper::IosCdHelper.parseIosCredentials('.')
|
||||||
|
UI.message("👉🏼 Credentials parsed.")
|
||||||
|
|
||||||
|
# Obtain App Store Connect API key
|
||||||
|
api_key = other_action.app_store_connect_api_key(
|
||||||
|
key_id: creds['apple_key_id'].to_s,
|
||||||
|
issuer_id: creds['apple_issuer_id'].to_s,
|
||||||
|
key_content: creds['apple_key_content'].to_s,
|
||||||
|
duration: 1200,
|
||||||
|
in_house: false
|
||||||
|
)
|
||||||
|
UI.message("👉🏼 API Key formated")
|
||||||
|
|
||||||
|
# Upload build to App Store Connect using Pilot
|
||||||
|
other_action.pilot(
|
||||||
|
api_key: api_key,
|
||||||
|
apple_id: creds['developer_app_id'].to_s,
|
||||||
|
app_identifier: creds['developer_app_identifier'].to_s,
|
||||||
|
skip_waiting_for_build_processing: false,
|
||||||
|
distribute_only: true,
|
||||||
|
skip_submission: true,
|
||||||
|
distribute_external: true,
|
||||||
|
notify_external_testers: true,
|
||||||
|
groups: [
|
||||||
|
"Bêta externe",
|
||||||
|
],
|
||||||
|
app_platform:'ios',
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.description
|
||||||
|
"Testflight and AppStore deployment plugin for Fastlane, simplifying the build and deployment porcess to internal, external, 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 Testflight / Appstore deloyment action streamlines the build and deployment to internal, external and production channels. Allow you to promote builds on testflight beta tests."
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.available_options
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.is_supported?(platform)
|
||||||
|
[:ios].include?(platform)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -5,31 +5,6 @@ require 'fastlane_core/ui/ui'
|
|||||||
module Fastlane
|
module Fastlane
|
||||||
module Helper
|
module Helper
|
||||||
class IosCdHelper
|
class IosCdHelper
|
||||||
# Define method to delete temporary keychain
|
|
||||||
def self.delete_temp_keychain(name)
|
|
||||||
if File.exist?(File.expand_path("~/Library/Keychains/#{name}-db"))
|
|
||||||
Actions::DeleteKeychainAction.run(
|
|
||||||
name: name
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Define method to create temporary keychain
|
|
||||||
def self.create_temp_keychain(name, password)
|
|
||||||
Actions::CreateKeychainAction.run(
|
|
||||||
name: name,
|
|
||||||
password: password,
|
|
||||||
unlock: false,
|
|
||||||
timeout: 0
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Define method to ensure that temporary keychain exists
|
|
||||||
def self.ensure_temp_keychain(name, password)
|
|
||||||
delete_temp_keychain(name)
|
|
||||||
create_temp_keychain(name, password)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check if a parameter is set or not
|
# Check if a parameter is set or not
|
||||||
def self.is_set(variable)
|
def self.is_set(variable)
|
||||||
str_variable = variable
|
str_variable = variable
|
||||||
@ -40,8 +15,7 @@ module Fastlane
|
|||||||
# Decrypts ios credentials
|
# Decrypts ios credentials
|
||||||
def self.decrypt_ios_keys(ios_directory)
|
def self.decrypt_ios_keys(ios_directory)
|
||||||
# Define the GPG command with options
|
# 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"
|
--output #{ios_directory}/ios_keys.zip #{ios_directory}/ios_keys.zip.gpg"
|
||||||
|
|
||||||
# Execute the GPG command using system
|
# Execute the GPG command using system
|
||||||
|
Loading…
x
Reference in New Issue
Block a user