update ManuallyUpdateCodeSigning lane so it can use local storage
This commit is contained in:
parent
d0f6f7d6a8
commit
fe5564da7b
|
|
@ -123,7 +123,7 @@ private_lane :buildConfiguration do |options|
|
|||
|
||||
openKeychain(options)
|
||||
|
||||
if is_ci
|
||||
if !options[:buildNumber].nil?
|
||||
increment_build_number(
|
||||
build_number: options[:buildNumber]
|
||||
)
|
||||
|
|
@ -278,25 +278,18 @@ private_lane :openKeychain do |options|
|
|||
end
|
||||
|
||||
lane :ManuallyUpdateCodeSigning do |options|
|
||||
# based on this article https://medium.com/@jonathancardoso/using-fastlane-match-with-existing-certificates-without-revoking-them-a325be69dac6
|
||||
require 'fastlane_core'
|
||||
register_local_storage_for_match()
|
||||
|
||||
require 'match'
|
||||
|
||||
conf = FastlaneCore::Configuration.create(Match::Options.available_options, {})
|
||||
conf.load_configuration_file("Matchfile")
|
||||
|
||||
git_url = conf.config_file_options[:git_url]
|
||||
shallow_clone = false
|
||||
branch = 'fastlane_certificates'
|
||||
|
||||
storage_conf = lambda do
|
||||
new_storage = Match::Storage.for_mode('git', { git_url: git_url, shallow_clone: shallow_clone, git_branch: branch, clone_branch_directly: false})
|
||||
storage_factory = lambda do
|
||||
new_storage = Match::Storage.for_mode('local', { git_url: get_signing_identities_path() })
|
||||
new_storage.download
|
||||
return new_storage
|
||||
end
|
||||
|
||||
encryption_conf_for_storage = lambda do |stor|
|
||||
new_encryption = Match::Encryption.for_storage_mode('git', { git_url: git_url, working_directory: stor.working_directory})
|
||||
encryption_factory = lambda do |stor|
|
||||
new_encryption = Match::Encryption.for_storage_mode('local', { working_directory: stor.working_directory })
|
||||
new_encryption.decrypt_files
|
||||
return new_encryption
|
||||
end
|
||||
|
|
@ -305,8 +298,8 @@ lane :ManuallyUpdateCodeSigning do |options|
|
|||
Dir[File.join(stor.working_directory, "**", "*.{cer,p12,mobileprovision}")]
|
||||
end
|
||||
|
||||
storage = storage_conf.call
|
||||
encryption = encryption_conf_for_storage.call(storage)
|
||||
storage = storage_factory.call
|
||||
encryption = encryption_factory.call(storage)
|
||||
old_files = get_all_files.call(storage)
|
||||
|
||||
sh("open #{storage.working_directory}")
|
||||
|
|
@ -329,8 +322,8 @@ lane :ManuallyUpdateCodeSigning do |options|
|
|||
# to avoid this we use storage twice if needed
|
||||
|
||||
if files_diff.length > 0
|
||||
storage = storage_conf.call
|
||||
encryption = encryption_conf_for_storage.call(storage)
|
||||
storage = storage_factory.call
|
||||
encryption = encryption_factory.call(storage)
|
||||
|
||||
files_to_delete = files_diff.map do |file|
|
||||
old_file = file
|
||||
|
|
@ -347,10 +340,7 @@ lane :ManuallyUpdateCodeSigning do |options|
|
|||
end
|
||||
|
||||
def sync_code_signing_using_options(options)
|
||||
Match::Storage.register_backend(type: 'local', storage_class: Touchlane::LocalStorage)
|
||||
Match::Encryption.register_backend(type: 'local', encryption_class: Match::Encryption::OpenSSL)
|
||||
|
||||
signing_identities_path = File.expand_path "../EncryptedSigningIdentities"
|
||||
register_local_storage_for_match()
|
||||
|
||||
match(
|
||||
app_identifier: options[:app_identifier],
|
||||
|
|
@ -360,13 +350,22 @@ def sync_code_signing_using_options(options)
|
|||
readonly: options[:readonly].nil? ? true : options[:readonly],
|
||||
storage_mode: "local",
|
||||
# we can't pass signing_identities_path as parameter name since params is hardcoded in match/runner.rb
|
||||
git_url: signing_identities_path,
|
||||
git_url: get_signing_identities_path(),
|
||||
skip_docs: true,
|
||||
keychain_name: options[:keychain_name],
|
||||
keychain_password: options[:keychain_password]
|
||||
)
|
||||
end
|
||||
|
||||
def register_local_storage_for_match
|
||||
Match::Storage.register_backend(type: 'local', storage_class: Touchlane::LocalStorage)
|
||||
Match::Encryption.register_backend(type: 'local', encryption_class: Match::Encryption::OpenSSL)
|
||||
end
|
||||
|
||||
def get_signing_identities_path
|
||||
File.expand_path "../EncryptedSigningIdentities"
|
||||
end
|
||||
|
||||
def fill_up_options_using_configuration_type(options, configuration_type)
|
||||
configuration = get_configuration_for_type(configuration_type.type)
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ module Touchlane
|
|||
|
||||
def delete_files(files_to_delete: [], custom_message: nil)
|
||||
files_to_delete.each do |file_name|
|
||||
target_path = current_file.gsub(self.working_directory + "/", "")
|
||||
target_path = file_name.gsub(self.working_directory + "/", "")
|
||||
File.delete(File.join(self.signing_identities_path, target_path))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue