Remy Moll cbada7e4a4
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m41s
Build and release debug APK / Build APK (pull_request) Failing after 4m46s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 16s
move secrets to hashicorp, don't use match (wip)
2024-12-14 16:39:27 +01:00

141 lines
3.8 KiB
Ruby

default_platform(:ios)
platform :ios do
desc "Load the App Store Connect API token"
lane :load_asc_api_token do
app_store_connect_api_key(
key_id: ENV["IOS_ASC_KEY_ID"],
issuer_id: ENV["IOS_ASC_ISSUER_ID"],
key_content: ENV["IOS_ASC_KEY_P8"],
is_key_content_base64: true,
in_house: false
)
end
desc "Installs signing certificate in the keychain and downloads provisioning profiles from App Store Connect"
lane :prepare_signing do |options|
team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
keychain_name = "signing"
keychain_password = "temp"
delete_keychain(
name: keychain_name
) if File.exist? File.expand_path("~/Library/Keychains/#{keychain_name}-db")
create_keychain(
name: keychain_name,
password: keychain_password,
default_keychain: true,
unlock: true,
timeout: 3600
)
import_certificate(
certificate_path: ENV["SIGNING_KEY_FILE_PATH"],
certificate_password: ENV["SIGNING_KEY_PASSWORD"],
keychain_name: keychain_name,
keychain_password: keychain_password
)
# fetches and installs provisioning profiles from ASC
sigh(
adhoc: options[:adhoc],
api_key: api_key,
readonly: true
)
end
desc "Deploy a new version to closed testing (testflight)"
lane :deploy_testing do
build_name = ENV["BUILD_NAME"]
build_number = ENV["BUILD_NUMBER"]
app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
load_asc_api_token
prepare_signing
profile_name = "App Provisioning Profile" # replace with the name of the profile to use for the build
output_name = "example-iOS" # specify the name of the .ipa file to generate
export_method = "app-store" # specify the export method
# turn off automatic signing during build so correct code signing identity is guaranteed to be used
update_code_signing_settings(
use_automatic_signing: false,
targets: ["main-target"], # specify which targets to update code signing settings for
code_sign_identity: "Apple Distribution", # replace with name of code signing identity if different
bundle_identifier: app_identifier,
profile_name: profile_name,
build_configurations: ["Release"] # only toggle code signing settings for Release configurations
)
sh(
"flutter",
"build",
"ipa",
"--release",
"--build-name=#{build_name}",
"--build-number=#{build_number}",
)
# sign the app (whithout rebuilding it)
build_app(
skip_build_archive: true,
archive_path: "../build/ios/archive/Runner.xcarchive"
provisioningProfiles: {
app_identifier => profile_name
}
)
upload_to_testflight
end
desc "Deploy a new version as a full release"
lane :deploy_release do
build_name = ENV["BUILD_NAME"]
build_number = ENV["BUILD_NUMBER"]
api_key = lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
sync_code_signing(
api_key: api_key,
type: "appstore",
readonly: true,
)
sh(
"flutter",
"build",
"ipa",
"--release",
"--build-name=#{build_name}",
"--build-number=#{build_number}",
)
# sign the app (whithout rebuilding it)
build_app(
skip_build_archive: true,
archive_path: "../build/ios/archive/Runner.xarchive"
)
upload_to_app_store(
skip_screenshots: true,
skip_metadata: true,
skip_app_rating_config: true,
skip_app_review_information: true,
skip_submission: false,
# automatically submit the app for review
automatic_release: true,
# automatically release the app after review
)
end