forked from ts1/BLEUnlock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease
executable file
·68 lines (55 loc) · 1.84 KB
/
release
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash -e
set -o pipefail
USERNAME=takeshisone@gmail.com
TEAM=42LGPQYC7M
APPNAME=BLEUnlock
BASEDIR=$(cd $(dirname $0); pwd)
BUILDDIR=$BASEDIR/build
RELEASEDIR=$BUILDDIR/Release
TMPDIR=$BUILDDIR/tmp
extract_info() {
local app=$1
local key=$2
plutil -p $app/Contents/Info.plist |
awk "/$key/ {print \$3}" |
sed 's/"//g'
}
notarize() {
local app=$1
local id=$(extract_info $app CFBundleIdentifier)
rm -f $TMPDIR/upload.zip
ditto -c -k --keepParent $app $TMPDIR/upload.zip
xcrun altool --notarize-app --primary-bundle-id $id --username $USERNAME \
--password "@keychain:AC_PASSWORD" --file $TMPDIR/upload.zip \
--asc-provider $TEAM 2>&1 | tee $TMPDIR/altool.log
uuid=$(awk '/^RequestUUID/ { print $3 }' $TMPDIR/altool.log)
while true; do
sleep 5
xcrun altool --notarization-info $uuid --username $USERNAME \
--password "@keychain:AC_PASSWORD" --asc-provider $TEAM 2>&1 |
tee $TMPDIR/altool.log || true
status=$(grep Status: $TMPDIR/altool.log | sed 's/^.*Status: *//')
if [ "$status" ] && [ "$status" != "in progress" ]; then
break
fi
done
if [ "$status" != "success" ]; then
exit 1
fi
xcrun stapler staple $app
}
#rm -rf $BUILDDIR
test -d $TMPDIR || mkdir -p $TMPDIR
xcodebuild \
-scheme $APPNAME \
-archivePath $RELEASEDIR/$APPNAME.xcarchive \
archive
xcodebuild \
-exportArchive \
-archivePath $RELEASEDIR/$APPNAME.xcarchive \
-exportOptionsPlist $BASEDIR/ExportOptions.plist \
-exportPath $RELEASEDIR
notarize $RELEASEDIR/$APPNAME.app/Contents/Library/LoginItems/Launcher.app
notarize $RELEASEDIR/$APPNAME.app
version=$(extract_info $RELEASEDIR/$APPNAME.app CFBundleShortVersionString)
ditto -c -k --keepParent $RELEASEDIR/$APPNAME.app $RELEASEDIR/$APPNAME-$version.zip