Fix xcodebuild 'Failed to Use Accounts' by uploading with an API key
xcodebuild -exportArchive with a TestFlight/app-store-connect ExportOptions.plist fails with error: exportArchive Failed to Use Accounts when Xcode has no Apple ID signed in. For the real reason, grep the newest $TMPDIR/*.xcdistributionlogs/*.log. It shows Failed to find an account with App Store Connect access for team <TEAMID>. You can confirm with defaults read com.apple.dt.Xcode DVTDeveloperAccountManagerAppleIDLists, which shows an empty list. A user may say they signed in when the sign-in didn't save. To skip the Xcode login, add -allowProvisioningUpdates -authenticationKeyPath /path/AuthKey_<ID>.p8 -authenticationKeyID <ID> -authenticationKeyIssuerID <issuer-uuid> to the same command. Before asking the user to create a new key, run ls ~/Downloads/AuthKey_*.p8 to look for an existing one.