ios: pass match keychain to codesign
Some checks failed
TestFlight / testflight (push) Failing after 55s

This commit is contained in:
2026-07-11 11:29:10 -07:00
parent b5a5d21767
commit a0e410155d

View File

@@ -8,7 +8,8 @@ TEAM_ID = "DQQH5H6GBD"
PROFILE_NAME = "Sybil AppStore CI" PROFILE_NAME = "Sybil AppStore CI"
CI_KEYCHAIN_NAME = "sybil_ci_keychain" CI_KEYCHAIN_NAME = "sybil_ci_keychain"
CI_KEYCHAIN_PASSWORD = "sybil-ci-keychain-password" CI_KEYCHAIN_PASSWORD = "sybil-ci-keychain-password"
CI_KEYCHAIN_DB_PATH = File.expand_path("~/Library/Keychains/#{CI_KEYCHAIN_NAME}-db") CI_KEYCHAIN_PATH = File.expand_path("~/Library/Keychains/#{CI_KEYCHAIN_NAME}")
CI_KEYCHAIN_DB_PATH = "#{CI_KEYCHAIN_PATH}-db"
IOS_ROOT = File.expand_path("..", __dir__) IOS_ROOT = File.expand_path("..", __dir__)
PROJECT_FILE = File.join(IOS_ROOT, "Sybil.xcodeproj") PROJECT_FILE = File.join(IOS_ROOT, "Sybil.xcodeproj")
PROJECT_SPEC = File.join(IOS_ROOT, "project.yml") PROJECT_SPEC = File.join(IOS_ROOT, "project.yml")
@@ -61,6 +62,26 @@ def stamp_marketing_version(version)
File.write(APP_PROJECT_SPEC, updated) File.write(APP_PROJECT_SPEC, updated)
end end
def ci_keychain_path
File.file?(CI_KEYCHAIN_DB_PATH) ? CI_KEYCHAIN_DB_PATH : CI_KEYCHAIN_PATH
end
def signing_xcargs
args = [
"DEVELOPMENT_TEAM=#{TEAM_ID.shellescape}",
"CODE_SIGN_STYLE=Manual",
"CODE_SIGN_IDENTITY=Apple\\ Distribution",
"PROVISIONING_PROFILE_SPECIFIER=#{PROFILE_NAME.shellescape}"
]
if ci?
args << "CODE_SIGN_KEYCHAIN=#{ci_keychain_path.shellescape}"
args << "OTHER_CODE_SIGN_FLAGS=#{("--keychain #{ci_keychain_path}").shellescape}"
end
args.join(" ")
end
platform :ios do platform :ios do
private_lane :app_store_api_key do private_lane :app_store_api_key do
app_store_connect_api_key( app_store_connect_api_key(
@@ -71,13 +92,13 @@ platform :ios do
) )
end end
# CI has no login keychain, so create a dedicated throwaway one for match to # CI uses a dedicated throwaway keychain for match. build_app passes this
# import the distribution cert into. The runner's launchd job sets # keychain explicitly so codesign does not depend on the runner's ambient
# SessionCreate, so add_to_search_list actually makes it visible to xcodebuild. # login/default keychain state.
private_lane :prepare_ci_keychain do private_lane :prepare_ci_keychain do
next unless ci? next unless ci?
delete_keychain(name: CI_KEYCHAIN_NAME) if File.file?(CI_KEYCHAIN_DB_PATH) delete_keychain(name: CI_KEYCHAIN_NAME) if File.file?(CI_KEYCHAIN_DB_PATH) || File.file?(CI_KEYCHAIN_PATH)
create_keychain( create_keychain(
name: CI_KEYCHAIN_NAME, name: CI_KEYCHAIN_NAME,
password: CI_KEYCHAIN_PASSWORD, password: CI_KEYCHAIN_PASSWORD,
@@ -130,12 +151,7 @@ platform :ios do
scheme: SCHEME, scheme: SCHEME,
export_method: "app-store", export_method: "app-store",
codesigning_identity: "Apple Distribution", codesigning_identity: "Apple Distribution",
xcargs: [ xcargs: signing_xcargs,
"DEVELOPMENT_TEAM=#{TEAM_ID.shellescape}",
"CODE_SIGN_STYLE=Manual",
"CODE_SIGN_IDENTITY=Apple\\ Distribution",
"PROVISIONING_PROFILE_SPECIFIER=#{PROFILE_NAME.shellescape}"
].join(" "),
export_options: { export_options: {
signingStyle: "manual", signingStyle: "manual",
teamID: TEAM_ID, teamID: TEAM_ID,