waiting for ios review
This commit is contained in:
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the App Store IPA, re-sign it locally and validate (or upload) it.
|
||||
#
|
||||
# Why the re-sign: Apple's cloud-managed distribution signing stores the
|
||||
# certificate name ("Apple Distribution: Ferenc Sági (8EQZ487TY9)") in each
|
||||
# binary's designated requirement in decomposed Unicode ("Sági"); the
|
||||
# certificate holds the composed form, so the requirement never matches and
|
||||
# App Store Connect rejects the build (ITMS-90035). We sign with our own
|
||||
# distribution certificate (scripts/asc_signing_setup.py) and an explicit
|
||||
# ASCII-only requirement keyed on the team ID.
|
||||
#
|
||||
# Usage: ./scripts/ios_release.sh [--upload]
|
||||
# Needs: ~/.appstoreconnect/private_keys/AuthKey_<KEY>.p8 and the setup above.
|
||||
set -euo pipefail
|
||||
|
||||
KEY_ID="${ASC_KEY_ID:-HGF8KY67BH}"
|
||||
ISSUER="${ASC_ISSUER:-69a6de8c-48b0-47e3-e053-5b8c7c11a4d1}"
|
||||
TEAM_ID="8EQZ487TY9"
|
||||
SIGN_DIR="$HOME/.appstoreconnect/skycontour"
|
||||
KEYCHAIN="$HOME/Library/Keychains/skycontour-signing.keychain-db"
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
# Non-login shells may lack flutter on PATH: fall back to the SDK recorded by Android tooling.
|
||||
if ! command -v flutter >/dev/null; then
|
||||
FLUTTER_SDK="$(sed -n 's/^flutter.sdk=//p' android/local.properties 2>/dev/null)"
|
||||
[ -x "$FLUTTER_SDK/bin/flutter" ] && export PATH="$FLUTTER_SDK/bin:$PATH"
|
||||
fi
|
||||
|
||||
[ -f "$SIGN_DIR/meta.json" ] || { echo "Run scripts/asc_signing_setup.py first." >&2; exit 1; }
|
||||
SHA1="$(python3 -I -c 'import json,sys; print(json.load(open(sys.argv[1]))["certificateSha1"])' "$SIGN_DIR/meta.json")"
|
||||
PROFILE="$SIGN_DIR/appstore.mobileprovision"
|
||||
security unlock-keychain -p "$(cat "$SIGN_DIR/keychain.password")" "$KEYCHAIN"
|
||||
|
||||
echo "==> Web bundle + App Store IPA"
|
||||
./scripts/build_web.sh > /dev/null
|
||||
flutter build ipa --release
|
||||
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
( cd "$WORK" && unzip -q "$ROOT/build/ios/ipa/SkyContour.ipa" )
|
||||
APP="$WORK/Payload/Runner.app"
|
||||
|
||||
# Same entitlements as Xcode produced (application-identifier, team, beta reports).
|
||||
codesign -d --entitlements :- "$APP" > "$WORK/entitlements.plist" 2>/dev/null
|
||||
cp "$PROFILE" "$APP/embedded.mobileprovision"
|
||||
|
||||
requirement() {
|
||||
echo "designated => anchor apple generic and identifier \"$1\" and certificate leaf[subject.OU] = \"$TEAM_ID\" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */"
|
||||
}
|
||||
|
||||
sign() { # path [entitlements]
|
||||
local id
|
||||
id="$(codesign -dv "$1" 2>&1 | sed -n 's/^Identifier=//p')"
|
||||
codesign --force --sign "$SHA1" --keychain "$KEYCHAIN" --timestamp=none \
|
||||
-r="$(requirement "$id")" ${2:+--entitlements "$2"} "$1"
|
||||
}
|
||||
|
||||
echo "==> Re-signing with the local distribution certificate"
|
||||
find "$APP/Frameworks" -maxdepth 1 \( -name '*.framework' -o -name '*.dylib' \) -print0 |
|
||||
while IFS= read -r -d '' f; do sign "$f"; done
|
||||
sign "$APP" "$WORK/entitlements.plist"
|
||||
# --verify also checks each binary against its designated requirement (the ITMS-90035 check).
|
||||
for f in "$APP"/Frameworks/*.framework "$APP"; do
|
||||
if ! out="$(codesign --verify --strict --verbose=2 "$f" 2>&1)" || grep -q 'does not satisfy' <<<"$out"; then
|
||||
echo "signature check failed: $out" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
codesign --verify --strict --deep "$APP"
|
||||
|
||||
OUT="$ROOT/build/ios/ipa/SkyContour-appstore.ipa"
|
||||
rm -f "$OUT"
|
||||
( cd "$WORK" && zip -qry "$OUT" Payload )
|
||||
echo "==> $OUT"
|
||||
|
||||
echo "==> Validating with App Store Connect"
|
||||
xcrun altool --validate-app -f "$OUT" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER"
|
||||
|
||||
if [ "${1:-}" = "--upload" ]; then
|
||||
echo "==> Uploading"
|
||||
xcrun altool --upload-app -f "$OUT" -t ios --apiKey "$KEY_ID" --apiIssuer "$ISSUER"
|
||||
fi
|
||||
Reference in New Issue
Block a user