I'm using Xcode 11 and Xcode server to try build and upload my app to TestFlight. I was trying to use a custom ExportOptions.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>YOUR_TEN_CHARACTER_TEAM_ID</string>
<key>destination</key>
<string>upload</string>
</dict>
</plist>
But then I get an error saying "Upload" is not supported by Xcode server. Suggestions online are to leave it as "Export" and use this to upload in a post-integration script:
altool --upload-app -f $XCS_PRODUCT -u <username> -p <app-specific password>
So I did that and I've tried setting the bot to use either:
instead of the custom plist. But now my Archive step is failing with the below error before even getting to the trigger:
Build Service Error: exportArchive: exportOptionsPlist error for key 'destination': expected one of {upload}, but found export
I've tried removing the trigger to see if that was causing an issue, but its not. Now my bot is simply trying to archive and export the project and i'm getting this error about destination should be upload ... which isn't supported.
Archiving the app and uploading from the "Distribute app" manually works fine.
Any help would be appreciated. I was hoping to do this without adding more tools as it should be possible on its own.
As discussed in the comments this is probably a bug in Xcode server.
Since the Xcode project already creates an archive, a viable option around this is to disable the export in the bot, and export an ipa-file with a Post-integration script trigger. This can be uploaded to App Store Connect.
The script would look like this:
#!/bin/sh
/usr/bin/xcodebuild -exportArchive -archivePath ${XCS_ARCHIVE} -exportPath "${XCS_DERIVED_DATA_DIR}" -exportOptionsPlist ${XCS_SOURCE_DIR}/someconfdir/export.plist
/usr/bin/xcrun altool --upload-app --type ios --file "${XCS_DERIVED_DATA_DIR}/appname.ipa" --username "xxx@y.z" --password "xxx"
You need a way to make Xcode server have access to export.plist. One option is to check it in in with the source code, so the above script finds it in some configuration folder using the XCS_SOURCE_DIR variable.
It should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>teamID</key>
<string>xxx</string>
<key>method</key>
<string>app-store</string>
<key>uploadSymbols</key>
<true/>
<key>provisioningProfiles</key>
<dict>
<key>bundleid</key>
<string>profilename</string>
</dict>
</dict>
</plist>