mirror of
https://github.com/burakgon/OpenScreens.git
synced 2026-12-02 05:10:11 +08:00
The release scripts signed and uploaded through the Apple ID that Xcode is signed in with, and Xcode had forgotten its account in the middle of a release: the archive was made and could not be sent. Named in the environment, an API key and its issuer are now handed to xcodebuild in the Apple ID's place. Version 1.1.1 for iPhone and iPad went to TestFlight that way. The Mac's disk image needs a Developer ID certificate, which a key may use only with access to cloud-managed distribution certificates; the script says so where it says how.
56 lines
2.0 KiB
Bash
Executable File
56 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Builds the iPhone and iPad app and uploads it to App Store Connect, where
|
|
# it becomes available to TestFlight testers once Apple has processed it.
|
|
#
|
|
# scripts/release-ios.sh
|
|
#
|
|
# Signing and the upload go through the Apple ID that Xcode is signed in
|
|
# with, for the team in Config/Signing.xcconfig. The app record has to exist
|
|
# in App Store Connect already.
|
|
#
|
|
# An App Store Connect API key can stand in for the Apple ID, which is what a
|
|
# machine nobody is signed in on needs, and what gets a release out when
|
|
# Xcode has forgotten its account:
|
|
#
|
|
# APP_STORE_CONNECT_KEY=/path/to/AuthKey_<key id>.p8 \
|
|
# APP_STORE_CONNECT_ISSUER=<issuer id> scripts/release-ios.sh
|
|
set -eu
|
|
|
|
. "$(dirname "$0")/lib/api-key.sh"
|
|
cd "$(dirname "$0")/.."
|
|
WORK="$(mktemp -d)"
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
TEAM=$(sed -n 's/^DEVELOPMENT_TEAM *= *//p' Config/Signing.xcconfig | head -1)
|
|
[ -n "$TEAM" ] || { echo "Set DEVELOPMENT_TEAM in Config/Signing.xcconfig first." >&2; exit 1; }
|
|
|
|
echo "Archiving..."
|
|
xcodebuild archive \
|
|
-project OpenScreens.xcodeproj -scheme "OpenScreens iOS" -configuration Release \
|
|
-destination "generic/platform=iOS" \
|
|
-archivePath "$WORK/OpenScreens.xcarchive" \
|
|
-allowProvisioningUpdates "$@" -quiet
|
|
|
|
cat > "$WORK/upload.plist" <<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-connect</string>
|
|
<key>destination</key><string>upload</string>
|
|
<key>signingStyle</key><string>automatic</string>
|
|
<key>teamID</key><string>$TEAM</string>
|
|
<key>manageAppVersionAndBuildNumber</key><true/>
|
|
<key>uploadSymbols</key><true/>
|
|
</dict>
|
|
</plist>
|
|
PLIST
|
|
|
|
echo "Uploading to App Store Connect..."
|
|
xcodebuild -exportArchive \
|
|
-archivePath "$WORK/OpenScreens.xcarchive" \
|
|
-exportOptionsPlist "$WORK/upload.plist" -exportPath "$WORK/upload" \
|
|
-allowProvisioningUpdates "$@"
|
|
|
|
echo "Uploaded. The build appears in TestFlight once Apple has processed it."
|