I have a Nativescript app which I want to publish to App Store Connect. I am using a CI/CD system setup as such:
This system used to work fine, until Apple started to make 2FA mandatory for all accounts interacting with App Store Connect in March 2021.
Since then, the command "tns publish ios" has been unable to send the binary to App Store Connect, mentioning an authentication error, and prompting me to enable 2FA on the Apple ID I used.
I've completed the following steps to make my CI/CD system work again:
After doing this, I can successfully build and upload an iOS app build on App Store Connect using my CI/CD system... For a few hours. After this happens, I have to regenerate a new session token using "tns apple-login".
It seems the 2FA support for the "tns publish ios" command was an aftertought. I can't imagine having to log-in every time I want to upload a binary is a good long term solution.
Has anyone else had that issue with a Nativescript app ? Any good alternatives for uploading an already built .ipa file to App Store Connect, using a CI/CD system ?
Just out of providing this question with an answer for other wanderers, here's what I did to solve my issues.
We have since then stopped using tns publish ios, it was clearly designed for manual use. Thankfully there were solutions out there.
Apple's solution to dealing with 2FA on CI/CD systems is to use the App Store Connect API.
More info on how it works here: https://developer.apple.com/documentation/appstoreconnectapi
Additionally, a good alternative to tns publish ios which supports the App Store Connect API for CI/CD systems is Fastlane.
They have a documentation page for this use case, which I followed: https://docs.fastlane.tools/app-store-connect-api/