forked from SignTools/SignTools-CI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign.sh
executable file
·29 lines (24 loc) · 1.06 KB
/
sign.sh
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
#!/bin/bash
set -e
echo "Obtaining files..."
curl -sS -L -H "Authorization: Bearer $SECRET_KEY" "$SECRET_URL/jobs" | tar -x
CERT_PASS=$(cat pass.txt)
SIGN_ARGS=$(cat args.txt)
UPLOAD_ID=$(cat id.txt)
XRESIGN_VERSION="d8003bb1308cddcab1a283a2bf4af99b0c8b1d8f"
curl -sS -L "https://raw.githubusercontent.com/SignTools/XReSign/$XRESIGN_VERSION/XReSign/Scripts/xresign.sh" --output xresign.sh
chmod +x xresign.sh
echo "Creating keychain..."
security create-keychain -p "1234" "sign"
security unlock-keychain -p "1234" "sign"
security default-keychain -s "sign"
echo "Importing certificate..."
security import "cert.p12" -P "$CERT_PASS" -A
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "1234" >/dev/null 2>&1
IDENTITY=$(security find-identity -p appleID -v | grep -o '".*"' | cut -d '"' -f 2)
echo "Signing..."
./xresign.sh -i unsigned.ipa -c "$IDENTITY" -p "prov.mobileprovision" $SIGN_ARGS >/dev/null 2>&1
rm unsigned.ipa
mv *.ipa file.ipa
echo "Uploading..."
curl -sS -H "Authorization: Bearer $SECRET_KEY" -F "[email protected]" "$SECRET_URL/jobs/$UPLOAD_ID"