-
-
Notifications
You must be signed in to change notification settings - Fork 166
/
release
executable file
·76 lines (61 loc) · 1.98 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
69
70
71
72
73
74
75
76
#!/bin/bash -e
set -o pipefail
if [ ! "$PASSWORD" ]; then
echo set app-specific password in PASSWORD env var
exit 1
fi
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 notarytool submit --apple-id $USERNAME --password "$PASSWORD" $TMPDIR/upload.zip \
--team-id $TEAM 2>&1 | tee $TMPDIR/altool.log
uuid=$(awk '/ id:/ { print $2; exit }' $TMPDIR/altool.log)
while true; do
sleep 2
xcrun notarytool info $uuid --apple-id $USERNAME \
--password "$PASSWORD" --team-id $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" != "Accepted" ]; 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
v=$version-$(extract_info $RELEASEDIR/$APPNAME.app CFBundleVersion)
mkdir -p archives/$v
cp -a "$RELEASEDIR/$APPNAME.xcarchive" archives/$v