Building and uploading to TestFlight
tools/testflight.sh step by step: inputs, the build number scheme, the unsigned Exact archive, the xcarchive wrapper, re-sealing, export and upload.

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

VERSION

version in package.json (0.1.0)

Marketing version, CFBundleShortVersionString

BUILD_NUMBER

from the clock, see below

CFBundleVersion

UPLOAD

1

0 signs and exports an .ipa only, without uploading

VERIFY

1

0 skips waiting for App Store Connect after upload

tools/testflight.sh VERSION=0.2.0 BUILD_NUMBER=3 tools/testflight.sh UPLOAD=0 tools/testflight.sh

Fixed 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

L34-L37

EXACT_VERSION=<version> EXACT_BUILD_NUMBER=<build> bun exact.mjs ios --device --archive <out>/unsigned.ipa --unsigned. Exact builds the device app and signs it ad hoc "for a service that re-signs it". Output goes to build.log; on failure the last 30 lines are printed

2

L39-L46

Unzip the .ipa with ditto, copy Payload/*.app into Seed.xcarchive/Products/Applications/

3

L47-L52

Assert that Info.plist carries the expected CFBundleShortVersionString, CFBundleVersion and CFBundleIdentifier. A mismatch prints Info.plist mismatch: ... and exits 1

4

L53-L58

Write ITSAppUsesNonExemptEncryption = false into the archived Info.plist

5

L59-L71

Re-seal the app ad hoc with entitlements written to archive.entitlements

6

L73-L89

Write the archive's own Info.plist (ApplicationProperties, ArchiveVersion 2, name and scheme Seed)

7

L91-L105

Write ExportOptions.plist

8

L107-L120

Unlock the signing keychain

9

L121-L132

xcodebuild -exportArchive with -allowProvisioningUpdates and the API key arguments; output to export.log, last 15 lines printed

10

L133-L142

If uploading and VERIFY is not 0: node tools/testflight-verify.mjs <build> <version>, output to verify.log

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

build.log

Exact's device build

unsigned.ipa, unpacked/, unsigned.dSYM

The unsigned build

Seed.xcarchive/

The wrapped archive

archive.entitlements, ExportOptions.plist

Generated inputs

export/, export.log

Xcode's export and upload

verify.log

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.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments