Automate distribution of Unreal Engine 5 to AppleTest Flight

Rmag Breaking News

To automate distributing a Unreal Engine 5.3.2 build to test flight, you can do the following. There may be other ways but this is the only way I got it working now.

Build the xarchive with something like:
RunUAT.command BuildCookRun -platform=IOS -project=ProjectName.uproject -clientConfiguration=Shipping -build -cook -stage -pak -package -distribution -archive

At this point, you have a ProjectName.xcarchive archive. Now is your chance to go into the archive and poke the plist file with your custom versions etc. I did it with a script something like this. Call the script with: ./UpdateProjectVersion.command “0.0.1”

#!/bin/bash
if [ -z $1 ]; then
echo “Usage: $0 <version_number>”
exit 1
fi

VERSION=$1

pushd /ProjectName/Root/Folder

#Note, we assume we only have one xcarchive in this folder. Make sure to clean up
for file in *.xcarchive; do
mv $file “ProjectName.xcarchive”
break # Only rename the first one found
done

PLIST=“ProjectName.xcarchive/Products/Applications/ProjectName.app/Info.plist”
if [ -f $PLIST ]; then
# Using awk to insert lines after the first occurrence of <dict>
awk -v ver=$VERSION ‘/<dict>/{print;print “<key>CFBundleVersion</key>n<string>”ver”</string>”;next}1’ $PLIST > temp.plist && mv temp.plist $PLIST
else
echo “Info.plist not found.”
exit 1
fi

popd

Now you need to get a good ExportOptions.plist file. I suggest you make an ad-hoc distribution with xcode and grab the file that is output in the same directory as the ipa.

Create an ipa.
xcodebuild -exportArchive -archivePath ProjectName.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath .
This will create the ipa in the current directory.

Validate the ipa
xcrun altool –validate-app -f ProjectName.ipa -t ios –apiKey APPSTORE_API_KEY_ID –apiIssuer APPSTORE_ISSUER_ID

Upload the ipa
xcrun altool –upload-app -f ProjectName.ipa -t ios –apiKey APPSTORE_API_KEY_ID –apiIssuer APPSTORE_ISSUER_ID

Note: Last two steps assume you have your app store key file in ~/.private_keys or one of the other valid search paths.

Leave a Reply

Your email address will not be published. Required fields are marked *