← back to CelebritySignatures
apps/mobile/scripts/eas-build-pty.exp
46 lines
#!/usr/bin/env expect
# Drive the FIRST interactive EAS iOS production build through a real PTY so EAS
# can generate + validate signing credentials using the ASC API key (env vars set
# by the caller) WITHOUT a 2FA prompt. Auto-accepts y/n credential prompts; hard
# aborts (exit 3) the instant it sees an Apple-ID password / 2FA / verification
# prompt — that is the only thing a human must do, and we must not fake it.
set timeout 600
log_user 1
spawn npx eas-cli build --platform ios --profile production --no-wait
expect {
-re "(?i)(apple id|password:|two-factor|verification code|6-digit|sign in to your apple|enter the code)" {
puts "\n\n>>> ABORT: EAS is asking for interactive Apple-ID/2FA auth — a human step. <<<\n"
exit 3
}
-re "(?i)error\[: \].*credential" {
puts "\n>>> credential error <<<\n"; exit 4
}
-re "Build details: (https://\[^\r\n \]+)" {
puts "\n>>> BUILD QUEUED: $expect_out(1,string) <<<\n"; exit 0
}
-re "(?i)(waiting for build to complete|build queued|build in progress|is now building)" {
puts "\n>>> BUILD STARTED/QUEUED <<<\n"; exit 0
}
-re "\\\[Y/n\\\]|\\\(Y/n\\\)|\\? \\(y/N\\)|Reuse|reuse this|Generate a new|Would you like to|Do you want to" {
# Accept the default (Enter) for credential setup confirmations.
send "\r"
exp_continue
}
-re "(?i)(select|choose).*(certificate|profile|option)" {
# Accept the highlighted default in any selection list.
send "\r"
exp_continue
}
timeout {
puts "\n>>> TIMEOUT waiting on EAS <<<\n"; exit 5
}
eof {
catch wait result
set code [lindex $result 3]
puts "\n>>> eas-cli exited: $code <<<\n"
exit $code
}
}