tools/testflight.sh turns the app directory into a signed build on TestFlight. Exact can produce an .ipa signed with plain codesign, but this script instead builds unsigned, wraps the app in a standard .xcarchive and lets xcodebuild -exportArchive sign with the local Apple Distribution identity and upload with the App Store Connect API key (testflight.sh L1-L13). The Clipper worker calls it; it can also be run by hand on the build Mac.
Inputs
Variable | Default | Meaning |
|---|---|---|
|
| Marketing version, |
| from the clock, see below |
|
|
|
|
|
|
|
tools/testflight.sh
VERSION=0.2.0 BUILD_NUMBER=3 tools/testflight.sh
UPLOAD=0 tools/testflight.shFixed in the script: team XSKC6RJDD8, the key metadata path, the provisioning profile name. The bundle id is read from app.json app.id (L15-L28). The script exits 1 at once if the key file, key id or issuer id cannot be read.
Build number scheme
<days since 2019-01-01>.<UTC hour>.<UTC minute> (L26): (now - 1546300800) / 86400, then date -u +%H.%M.
Worked example: 2026-11-30 at 12:14 UTC. 2019-01-01 to 2026-01-01 is 2557 days; 30 November is 333 days into 2026. The build number is 2890.12.14, which is the number #1471 reports for that day's delivery.
The number must match ^[0-9]{1,4}([.][0-9]{1,2}){0,2}$, else exit 2 (L29-L31). The shell form zero pads hour and minute (09.05); the worker's allocate_build does not (9.5). App Store Connect drops leading zeros, and the verifier normalises them, so both name the same build.
Steps
# | Lines | What happens |
|---|---|---|
1 |
| |
2 | Unzip the | |
3 | Assert that | |
4 | Write | |
5 | Re-seal the app ad hoc with entitlements written to | |
6 | Write the archive's own | |
7 | Write | |
8 | Unlock the signing keychain | |
9 |
| |
10 | If uploading and |
Why each unusual step exists
Export compliance (step 4). The key is declared in the build "so TestFlight never asks per upload. false = the app uses only exempt encryption (standard published algorithms: XChaCha20-Poly1305, Ed25519, HKDF)". The declaration is dated 2026-11-26. "Exact's app.json has no field for it, so it is written before the re-seal below." If it is ever missing, testflight-verify.mjs makes the same declaration through the API.
Re-seal (step 5). "Exact's ad-hoc signature carries an application-identifier without the team prefix, which the export rejects against the store profile." The script signs again ad hoc (codesign --force --sign -) with the entitlements Xcode would have archived: application-identifier and keychain-access-groups as <team>.<bundle id>, com.apple.developer.team-identifier, and get-task-allow false. Editing Info.plist in step 4 changes sealed content, so the declaration is written before this re-seal (the comment says so; the reason is inferred).
ExportOptions (step 7). method app-store-connect, destination upload (or export when UPLOAD=0), signingStyle manual, signingCertificate Apple Distribution, the provisioning profile mapped by bundle id, uploadSymbols false, manageAppVersionAndBuildNumber false so Xcode keeps the script's numbers.
Keychain unlock without argv (step 8). A short Python program calls SecKeychainOpen and SecKeychainUnlock from the Security framework through ctypes, reading the password file in process, "so it never appears in process arguments or build logs". It unlocks "only the Seed signing keychain in the login agent's security session". Paths are on Signing and credentials.
Sanitised PATH (step 9). xcodebuild runs with PATH=/usr/bin:/bin:/usr/sbin:/sbin because "Apple's export shells out to rsync; Homebrew's rsync on PATH breaks it".
Success test. A zero exit code is not enough: export.log must also contain EXPORT SUCCEEDED, Upload succeeded or UPLOAD SUCCEEDED, else the script prints export/upload failed (<rc>): <log> and exits 1.
Outputs
Everything is under target/testflight/<build>/ in the app directory:
File | Content |
|---|---|
| Exact's device build |
| The unsigned build |
| The wrapped archive |
| Generated inputs |
| Xcode's export and upload |
| App Store Connect polling |
After a successful delivery the worker deletes the archive, the unpacked app, the dSYM, the export directory and the .ipa, and keeps the logs.
User stories
The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).
US-TEAM-01 Get every merged app change on TestFlight: testflight.sh: build number scheme, unsigned archive, re-seal, export and upload
US-TEAM-07 Find out why a build did not ship and fix it: Each step of the build script and its error messages
Related
The Exact framework, which provides ios --device --archive --unsigned
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime