-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathupload_ios.sh
More file actions
executable file
·68 lines (59 loc) · 2.56 KB
/
Copy pathupload_ios.sh
File metadata and controls
executable file
·68 lines (59 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# MeshMapper iOS upload script
# Uploads the Xcode archive produced by Build.sh (flutter build ipa) to
# App Store Connect using an ASC API key, via xcodebuild -exportArchive
# with ios/ExportOptionsUpload.plist (destination: upload).
#
# Auth: expects ASC_KEY_ID and ASC_ISSUER_ID (optionally ASC_KEY_PATH) in the
# environment or ~/.meshmapper_release.env. The .p8 key lives at
# ~/.appstoreconnect/private_keys/AuthKey_<KEY_ID>.p8 by default.
#
# Fallback if a future Xcode breaks this path (altool is deprecated but still ships):
# xcrun altool --upload-app -f <ipa> -t ios --apiKey "$ASC_KEY_ID" --apiIssuer "$ASC_ISSUER_ID"
#
# The TestFlight "What to Test" text is not part of the archive and cannot be set
# here. Run ./set_whats_new.sh after this, once App Store Connect registers the build.
#
# Usage: ./upload_ios.sh [path/to/Runner.xcarchive]
set -e
cd "$(dirname "$0")"
# Local release secrets (optional, never committed; lives outside the repo)
RELEASE_ENV="$HOME/.meshmapper_release.env"
if [ -f "$RELEASE_ENV" ]; then
source "$RELEASE_ENV"
fi
if [ -z "$ASC_KEY_ID" ] || [ -z "$ASC_ISSUER_ID" ]; then
echo "Error: ASC_KEY_ID and ASC_ISSUER_ID must be set (env or $RELEASE_ENV)."
echo "Create an App Store Connect API key under Users and Access > Integrations."
exit 1
fi
ASC_KEY_PATH="${ASC_KEY_PATH:-$HOME/.appstoreconnect/private_keys/AuthKey_${ASC_KEY_ID}.p8}"
if [ ! -f "$ASC_KEY_PATH" ]; then
echo "Error: API key file not found: $ASC_KEY_PATH"
echo "Download the .p8 from App Store Connect and place it there (chmod 600)."
exit 1
fi
# Archive path: argument > .last_build metadata > default flutter output location
ARCHIVE_PATH="$1"
if [ -z "$ARCHIVE_PATH" ] && [ -f .last_build ]; then
ARCHIVE_PATH=$(grep '^ARCHIVE_PATH=' .last_build | cut -d= -f2-)
fi
ARCHIVE_PATH="${ARCHIVE_PATH:-build/ios/archive/Runner.xcarchive}"
if [ ! -d "$ARCHIVE_PATH" ]; then
echo "Error: No archive at $ARCHIVE_PATH - run ./Build.sh first."
exit 1
fi
echo "Uploading $ARCHIVE_PATH to App Store Connect..."
xcodebuild -exportArchive \
-archivePath "$ARCHIVE_PATH" \
-exportOptionsPlist ios/ExportOptionsUpload.plist \
-exportPath build/ios/upload \
-allowProvisioningUpdates \
-authenticationKeyPath "$ASC_KEY_PATH" \
-authenticationKeyID "$ASC_KEY_ID" \
-authenticationKeyIssuerID "$ASC_ISSUER_ID"
echo ""
echo "Upload accepted. The build appears in TestFlight after Apple-side processing (~5-15 min)."
echo ""
echo "To set the TestFlight \"What to Test\" text for this build:"
echo " ./set_whats_new.sh --notes-file <file>"