I'm trying to export my Mac App via Commandline, it works if I go through the Xcode interface, but I want to automate it. I'm confused by the signing steps I need to go through as a Mac App has two certificates, one for the installer, and one for the main app, so far I have the following, but when I come to export, how do I specify what certificate goes where?
xcodebuild -project "App.xcodeproj" -scheme "App" -configuration "Release" -destination "generic/platform=macOS,name=Any Mac" clean archive -archivePath export/App.xcarchive -verbose CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
codesign --entitlements "/Production.entitlements" -f -s "Apple Distribution: Company LTD (CompanyID)" "export/App.xcarchive/Products/Applications/App.app"
xcodebuild -exportArchive -archivePath export/App.xcarchive -exportOptionsPlist "Support/ExportOptions.plist" -exportPath "export"
productbuild --component "export/App.xcarchive/Products/Applications/App.app" /Applications "export/App_unsigned.pkg"
productsign --sign "3rd Party Mac Developer Installer: Company LTD (CompanyID)" "export/App_unsigned.pkg" "export/App.pkg"
I wish I could see how Archiving works in Xcode to see what I'm missing here