Is there a way to use expo build:ios on a CI environment and pass 2 factor authentication ?
I'm having troubles to start a build using expo on our CI environment due to the 2 factor authentication required for my apple developer account.
Is the expo build:ios command supposed to only be used locally or without 2 factor authentication ?
Running the build locally in interactive mode works - password and 2 factor auth was required only the first time I chose to build the app. For consecutive build I only use expo build:ios --release-channel test and that's it
My CI environment is google's Cloud Build - it runs in a Docker container, so I can't go and do a one time manual login to have the runner persist some session information like it happens locally can I?
After reading the cli usage information for expo build:ios and that you can setup your account password as ENV variable like EXPO_APPLE_PASSWORD I though it should be possible to use it in a CI environment
But then I get the following result:
expo login --non-interactive -u XXX
Success. You are now logged in as XXX.
expo build:ios --non-interactive --no-wait --release-channel test --apple-id XXXXX --team-id F7NE7X9ZFW
- Making sure project is set up correctly...
[16:43:00] Checking if there is a build in progress...
[16:43:00] Trying to authenticate with Apple Developer Portal...
Two-factor Authentication (6 digits code) is enabled for account 'XXXXX'
More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915
If you're running this in a non-interactive session (e.g. server or CI)
check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification
...
Please enter the 6 digit code:
[16:43:02] Authentication with Apple Developer Portal failed!
[16:43:02] Reason: Unknown reason, raw: "The input stream is exhausted."
So I follow the link for non-interactive sessions: https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification
And I see that I have to create and use a FASTLANE_SESSION environment variable.
But at that point I'm, not sure whether it will work as it seems this is coming from some tooling that expo uses internally.
I guess I can install fastlane locally and try to generate this variable with the command fastlane spaceauth -u user@example.org. I didn't find anything about this in the expo documentation though
There's information on using expo build:ios to build standalone apps, it covers only how to build them locally https://docs.expo.io/versions/v36.0.0/distribution/building-standalone-apps/
They have a guide for a CI flow ("on Your CI") - but it's using turtle-cli and for iOS it requres to run on a mac environment - it covers how to do builds yourself on your own machine and not using expo.io https://docs.expo.io/versions/v36.0.0/distribution/turtle-cli/
Another thing that I've tried is running like:
expo build:ios \
--team-id YOUR_TEAM_ID \
--dist-p12-path /path/to/your/dist/cert.p12 \
--provisioning-profile-path /path/to/your/provisioning/profile.mobileprovision
With the EXPO_IOS_DIST_P12_PASSWORD set as env variable but the build would fail as it still needs apple id and password
Is there a way that I can share or copy my local session - the session that expo created the first time I ran build:ios where I'm authenticated and I'm not prompted for password anymore to the CI machine?
Despite the troublesome warnings at the start the build works and produces an