Fastlane now (as of version 2.160.0) supports Apple's App Store Connect API. This avoids all the problems with 2FA session hacks. There are still a few fastlane actions that do not have full support but the majority do.
https://docs.fastlane.tools/app-store-connect-api/ explains how to start using an API key in fastlane.
In summary, here's what you need to do (these examples come straight from that documentation):
- Create an App Store Connect API Key
- From that same page, download the new key .p8 private key file and save it somewhere safe (WARNING: you can only download it once). Take note of the Key ID and the Issuer ID as you'll need them again shortly.
- Either use the
app_store_connect_api_key
action to specify the new key in your Fastfile
:
lane :release do
api_key = app_store_connect_api_key(
key_id: "D383SF739",
issuer_id: "6053b7fe-68a8-4acb-89be-165aa6465141",
key_filepath: "./AuthKey_D383SF739.p8",
duration: 1200, # optional
in_house: false, # optional but may be required if using match/sigh
)
pilot(api_key: api_key)
end
Or, write the details to a JSON file:
{
"key_id": "D383SF739",
"issuer_id": "6053b7fe-68a8-4acb-89be-165aa6465141",
"key": "-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHknlhdlYdLu
-----END PRIVATE KEY-----",
"duration": 1200, # optional
"in_house": false, # optional but may be required if using match/sigh
}
and reference the JSON file either in your Fastfile
:
lane :release do
pilot( api_key_path: "fastlane/D383SF739.json" )
end
Or via the command line:
$ fastlane pilot distribute --api_key_path fastlane/D383SF739.json
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…