2023-11-23 21:08:14 -04:00
|
|
|
platform :ios do
|
2023-11-23 20:29:47 -04:00
|
|
|
|
|
|
|
desc "Create a temporary keychain"
|
|
|
|
lane :create_temp_keychain do
|
|
|
|
UI.message("Creating a temporary keychain...")
|
|
|
|
|
|
|
|
create_keychain(
|
|
|
|
name: "temp_keychain",
|
|
|
|
password: ENV["KEYCHAIN_PASSWORD"],
|
|
|
|
default_keychain: true,
|
|
|
|
unlock: true,
|
|
|
|
timeout: 3600,
|
|
|
|
lock_when_sleeps: true
|
|
|
|
)
|
|
|
|
|
|
|
|
UI.message("Temporary keychain created successfully.")
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Synchronize certificates and provisioning profiles"
|
|
|
|
lane :setup_provisioning_profiles do
|
|
|
|
UI.message("Setting up provisioning profiles...")
|
|
|
|
target_to_app_identifier = {
|
|
|
|
'BlueWallet' => 'io.bluewallet.bluewallet',
|
|
|
|
'BlueWalletWatch' => 'io.bluewallet.bluewallet.watch',
|
|
|
|
'BlueWalletWatchExtension' => 'io.bluewallet.bluewallet.watch.extension',
|
|
|
|
'Stickers' => 'io.bluewallet.bluewallet.Stickers',
|
|
|
|
'MarketWidget' => 'io.bluewallet.bluewallet.MarketWidget'
|
|
|
|
}
|
|
|
|
|
|
|
|
target_to_app_identifier.each do |target, app_identifier|
|
|
|
|
match(
|
|
|
|
git_basic_authorization: ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
|
|
|
|
git_url: ENV["GIT_URL"],
|
|
|
|
type: "appstore",
|
|
|
|
app_identifier: app_identifier,
|
|
|
|
team_id: ENV["ITC_TEAM_ID"],
|
|
|
|
team_name: ENV["ITC_TEAM_NAME"],
|
|
|
|
readonly: true,
|
|
|
|
keychain_name: "temp_keychain",
|
|
|
|
keychain_password: ENV["KEYCHAIN_PASSWORD"]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Clear derived data"
|
|
|
|
lane :clear_derived_data_lane do
|
|
|
|
UI.message("Clearing derived data...")
|
|
|
|
clear_derived_data
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Increment build number"
|
|
|
|
lane :increment_build_number_lane do
|
|
|
|
UI.message("Incrementing build number...")
|
|
|
|
increment_build_number(xcodeproj: "BlueWallet.xcodeproj")
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Install CocoaPods dependencies"
|
|
|
|
lane :install_pods do
|
|
|
|
UI.message("Installing CocoaPods dependencies...")
|
|
|
|
cocoapods
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Build the application"
|
|
|
|
lane :build_app_lane do
|
|
|
|
UI.message("Building the application...")
|
|
|
|
build_app(
|
|
|
|
scheme: "BlueWallet",
|
|
|
|
workspace: "BlueWallet.xcworkspace",
|
|
|
|
export_method: "app-store",
|
|
|
|
include_bitcode: true,
|
|
|
|
configuration: "Release",
|
|
|
|
skip_profile_detection: true,
|
|
|
|
include_symbols: true,
|
|
|
|
export_team_id: ENV["ITC_TEAM_ID"],
|
|
|
|
export_options: {
|
|
|
|
signingStyle: "manual",
|
|
|
|
provisioningProfiles: {
|
|
|
|
'io.bluewallet.bluewallet' => 'match AppStore io.bluewallet.bluewallet',
|
|
|
|
'io.bluewallet.bluewallet.watch' => 'match AppStore io.bluewallet.bluewallet.watch',
|
|
|
|
'io.bluewallet.bluewallet.watch.extension' => 'match AppStore io.bluewallet.bluewallet.watch.extension',
|
|
|
|
'io.bluewallet.bluewallet.Stickers' => 'match AppStore io.bluewallet.bluewallet.Stickers',
|
|
|
|
'io.bluewallet.bluewallet.MarketWidget' => 'match AppStore io.bluewallet.bluewallet.MarketWidget'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
xcargs: "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) VERBOSE_LOGGING=1'",
|
|
|
|
output_directory: "./build_output",
|
|
|
|
buildlog_path: "./build_logs"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload to TestFlight"
|
|
|
|
lane :upload_to_testflight_lane do
|
|
|
|
UI.message("Uploading to TestFlight...")
|
|
|
|
api_key = app_store_connect_api_key(
|
|
|
|
key_id: ENV["APP_STORE_CONNECT_API_KEY_KEY_ID"],
|
|
|
|
issuer_id: ENV["APP_STORE_CONNECT_API_KEY_ISSUER_ID"],
|
|
|
|
key_filepath: "./appstore_api_key.p8"
|
|
|
|
)
|
|
|
|
upload_to_testflight(api_key: api_key, skip_waiting_for_build_processing: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Clean up build artifacts"
|
|
|
|
lane :clean_build_artifacts_lane do
|
|
|
|
UI.message("Cleaning up build artifacts...")
|
|
|
|
clean_build_artifacts
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Deploy to TestFlight"
|
|
|
|
lane :deploy do |options|
|
|
|
|
UI.message("Starting build process...")
|
|
|
|
|
|
|
|
# Update the WWDR certificate
|
|
|
|
update_wwdr_certificate
|
|
|
|
|
|
|
|
setup_app_store_connect_api_key
|
|
|
|
setup_provisioning_profiles
|
|
|
|
clear_derived_data_lane
|
|
|
|
increment_build_number_lane
|
|
|
|
|
|
|
|
unless File.directory?("Pods")
|
|
|
|
install_pods
|
|
|
|
end
|
|
|
|
|
|
|
|
build_app_lane
|
|
|
|
upload_to_testflight_lane
|
|
|
|
clean_build_artifacts_lane
|
|
|
|
|
|
|
|
# Clean up and delete the temporary keychain
|
|
|
|
delete_keychain(name: "temp_keychain")
|
|
|
|
|
|
|
|
# Mark deployment as completed for the current commit
|
|
|
|
last_commit = last_git_commit
|
|
|
|
already_built_flag = ".already_built_#{last_commit[:sha]}"
|
|
|
|
File.write(already_built_flag, Time.now.to_s)
|
2023-11-23 21:08:14 -04:00
|
|
|
end
|
|
|
|
end
|