Merge pull request #288 from TouchInstinct/feature/update_api_keys

Feature/update api keys
This commit is contained in:
svshkv 2021-11-19 10:37:52 +03:00 committed by GitHub
commit a202bc1c68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 14 deletions

View File

@ -82,14 +82,16 @@ private_lane :uploadToFirebase do |options|
)
end
private_lane :uploadToAppStore do |options|
def upload_to_app_store_using_options(options)
upload_to_app_store(
username: options[:username] || options[:apple_id],
api_key_path: options[:api_key_path],
ipa: options[:ipa_path],
force: true, # skip metainfo prompt
skip_metadata: true,
team_id: options[:itc_team_id],
dev_portal_team_id: options[:team_id]
dev_portal_team_id: options[:team_id],
precheck_include_in_app_purchases: false
)
end
@ -164,7 +166,7 @@ private_lane :buildConfiguration do |options|
sync_code_signing_using_options(options)
buildArchive(options)
uploadToAppStore(options)
upload_to_app_store_using_options(options)
end
end
@ -234,8 +236,8 @@ lane :SyncSymbols do |options|
xcodeproj_path = File.expand_path "../#{appName}.xcodeproj"
version_number = options[:version] || get_version_number(xcodeproj: xcodeproj_path, target: appName)
build_number = options[:build_number] || get_build_number(xcodeproj: xcodeproj_path)
version_number = options[:version] || "latest"
build_number = options[:build_number]
if configuration.type.is_app_store
download_dsyms(
@ -346,6 +348,7 @@ def sync_code_signing_using_options(options)
match(
app_identifier: options[:app_identifier],
username: options[:username] || options[:apple_id],
api_key_path: options[:api_key_path],
team_id: options[:team_id],
type: options[:type],
readonly: options[:readonly].nil? ? true : options[:readonly],
@ -370,7 +373,16 @@ end
def fill_up_options_using_configuration_type(options, configuration_type)
configuration = get_configuration_for_type(configuration_type.type)
configuration.to_options
if configuration_type.is_app_store || configuration_type.is_development
api_key_path = "fastlane/#{configuration_type.prefix}_api_key.json"
else
api_key_path = nil
end
default_options = {:api_key_path => api_key_path}
default_options
.merge(configuration.to_options)
.merge(get_keychain_options(options))
.merge(options)
end
@ -402,7 +414,35 @@ def get_google_services_plist_path(app_target_folder_name, configuration_type)
File.expand_path "../#{app_target_folder_name}/Resources/#{configuration_type.prefix}-GoogleService-Info.plist"
end
def set_xcconfig_for_configuration_of_project(xcconfig_name, configuration, xcodeproj_path)
def generate_enabled_features_extension_if_needed(options)
app_target_folder_name = options[:appName] || $appName
project_enabled_features_file_path = File.expand_path "../#{app_target_folder_name}/Resources/Features/Enabled.swift"
build_settings_file_path = File.expand_path "../common/build_settings.yaml"
unless is_feature_extension_needed?(options, project_enabled_features_file_path)
return
end
if options[:features].nil?
builder_features_list = [] # If Enabled.swift exists and features option is nil we need to create empty extension to avoid unexpected features
else
builder_features_list = options[:features]
.split(",").map { |feature_name| feature_name.strip } # [ "Feature1", "Feature2", "Feature3" ]
end
build_settings_features_list = Managers::FileManager.load_from_file_YAML(build_settings_file_path)["features"]
enabled_features_extension = Touchlane::Features.generate_enabled_features_extension(builder_features_list, build_settings_features_list)
Managers::FileManager.save_data_to_file(project_enabled_features_file_path, enabled_features_extension)
end
def is_feature_extension_needed?(options, project_enabled_features_file_path)
!options[:features].nil? || File.exists?(project_enabled_features_file_path)
end
def set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
require 'xcodeproj'
project = Xcodeproj::Project.open(xcodeproj_path)
@ -419,7 +459,7 @@ def set_xcconfig_for_configuration_of_project(xcconfig_name, configuration, xcod
application_targets.each do |target|
build_configuration = target.build_configuration_list[configuration]
config_name = target.name + xcconfig_name
config_name = target.name + lane_name
build_configuration_reference = project.files.select { |f| f.path.start_with?(config_name) }.first
build_configuration.base_configuration_reference = build_configuration_reference
end

View File

@ -14,16 +14,21 @@ module Touchlane
def initialize(type)
@type = type
@is_app_store = type == APP_STORE
@is_development = type == DEVELOPMENT
case type
when DEVELOPMENT, ENTERPRISE
when DEVELOPMENT
@export_method = type
@configuration = type == DEVELOPMENT ? "Debug" : "Release"
@is_app_store = false
@prefix = type == DEVELOPMENT ? DEVELOPMENT_PREFIX : ENTERPRISE_PREFIX
@configuration = "Debug"
@prefix = DEVELOPMENT_PREFIX
when ENTERPRISE
@export_method = type
@configuration = "Release"
@prefix = ENTERPRISE_PREFIX
when APP_STORE
@export_method = "app-store"
@configuration = "AppStore"
@is_app_store = true
@prefix = APP_STORE_PREFIX
else
raise "Unknown type passed #{type}"
@ -32,7 +37,7 @@ module Touchlane
private_class_method :new
attr_reader :export_method, :type, :configuration, :is_app_store, :prefix
attr_reader :export_method, :type, :configuration, :is_app_store, :is_development, :prefix
def self.from_lane_name(lane_name)
case