forked from Toxblh/MTMR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·72 lines (60 loc) · 2.08 KB
/
build.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
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
# INSTALL xcpretty: sudo gem install xcpretty
NAME='MTMR'
rm -r Release 2>/dev/null
xcodebuild archive \
-scheme "$NAME" \
-archivePath Release/App.xcarchive | xcpretty -c
xcodebuild \
-exportArchive \
-archivePath Release/App.xcarchive \
-exportOptionsPlist export-options.plist \
-exportPath Release | xcpretty -c
cd Release
rm -r App.xcarchive
# Prerequisite: npm i -g create-dmg
NAME_DMG="${NAME}.app"
echo $NAME_DMG
create-dmg $NAME_DMG
DATE=`LC_ALL=en_US.utf8 date +"%a, %d %b %Y %H:%M:%S %z"`
BUILD=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${NAME}.app/Contents/Info.plist`
VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ${NAME}.app/Contents/Info.plist`
MINIMUM=`/usr/libexec/PlistBuddy -c "Print LSMinimumSystemVersion" ${NAME}.app/Contents/Info.plist`
SIZE=`stat -f%z MTMR\ ${VERSION}.dmg`
SIGN=`~/Sparkle/bin/sign_update MTMR\ ${VERSION}.dmg ~/Sparkle/bin/dsa_priv.pem | awk '{printf "%s",$0} END {print ""}'`
SHA256=`shasum -a 256 MTMR\ ${VERSION}.dmg | awk '{print $1}'`
# ditto -c -k --sequesterRsrc --keepParent "${NAME}.app" "${NAME}v${VERSION}.zip"
echo DATE $DATE
echo VERSION $VERSION
echo BUILD $BUILD
echo MINIMUM $MINIMUM
echo SIZE $SIZE
echo SIGN ${SIGN}
echo "<?xml version=\"1.0\" standalone=\"yes\"?>
<rss xmlns:sparkle=\"http://www.andymatuschak.org/xml-namespaces/sparkle\" version=\"2.0\">
<channel>
<item>
<title>${VERSION}</title>
<pubDate>${DATE}</pubDate>
<description>
${1}
</description>
<sparkle:minimumSystemVersion>${MINIMUM}</sparkle:minimumSystemVersion>
<enclosure url=\"https://mtmr.app/MTMR%20${VERSION}.dmg\"
sparkle:version=\"${BUILD}\"
sparkle:shortVersionString=\"${VERSION}\"
length=\"${SIZE}\"
type=\"application/octet-stream\"
sparkle:dsaSignature=\"${SIGN}\"
/>
</item>
</channel>
</rss>" > appcast.xml
echo ""
echo "Homebrew https://github.com/Homebrew/homebrew-cask/edit/master/Casks/mtmr.rb"
echo ""
echo " version '${VERSION}'"
echo " sha256 '${SHA256}'"
echo ""
echo "Update MTMR v${VERSION}"
scp MTMR\ ${VERSION}.dmg do:/var/www/mtmr
scp appcast.xml do:/var/www/mtmr