Configure your project with fastlane, then copy the files into the built project or merge them whenever you need to automate a build.
default_platform(:ios)
platform :ios do
lane :beta do
clear_derived_data
build_app(scheme: "Unity-iPhone", include_bitcode: true, export_xcargs: "-allowProvisioningUpdates")
changelog_from_git_commits
# you can specify various settings here, just read the Fastlane docs. This is for automated testing
upload_to_testflight(distribute_external: true, groups: ["Public"])
end
end
app_identifier("com.example.app")
apple_id("[email protected]")
itc_team_id("1234567") # see https://stackoverflow.com/questions/42960644/how-to-get-itunes-connect-team-id-and-team-name/46415415
team_id("K1234567")
That's it. You can write a script that copies these two files into the appropriate directory when you build your project:
UNITY_VERSION=$(cat ProjectSettings/ProjectVersion.txt | tr " " "\n" | sed -n 2p)
UNITY=/Applications/Unity/Hub/Editor/${UNITY_VERSION}/Unity.app/Contents/MacOS/Unity
${UNITY} \
-buildTarget iOS \
-batchmode \
-nographics \
-silent-crashes \
-logFile ./unity.log \
-projectPath $(pwd) \
-quit \
-executeMethod # after executeMethod, your custom c# build static method that puts the build into a specified directory
cp -r fastlane your/build/directory/fastlane
cd your/build/directory
fastlane ios beta