-
Notifications
You must be signed in to change notification settings - Fork 234
/
make_zips_and_appcast.sh
executable file
·97 lines (82 loc) · 2.87 KB
/
make_zips_and_appcast.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
GREEN="\033[0;32m"
RED="\033[0;31m"
NC="\033[0m" # No Color
# If Itsycal.app is not found on the Desktop, quit.
APP_PATH="${HOME}/Desktop/Itsycal.app"
if [ ! -d "${APP_PATH}" ]
then
echo "\n"
echo " + ${RED}NOT FOUND:${NC} ${APP_PATH}"
echo " + Export notarized Itsycal.app to Desktop."
echo " + See BUILD.md for instructions."
echo "\n"
exit 1
fi
# Get the bundle version from the plist.
PLIST_FILE="${APP_PATH}/Contents/Info.plist"
VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${PLIST_FILE})
SHORT_VERSION_STRING=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ${PLIST_FILE})
# Set up file names and paths.
ZIP_NAME="Itsycal-${SHORT_VERSION_STRING}.zip"
ZIP_NAME=${ZIP_NAME// /-}
DEST_DIR="${HOME}/Desktop/Itsycal-${SHORT_VERSION_STRING}"
XML_PATH="${DEST_DIR}/itsycal.xml"
ZIP_PATH1="${DEST_DIR}/${ZIP_NAME}"
ZIP_PATH2="${DEST_DIR}/Itsycal.zip"
# Run some diagnostics so we can see all is ok."
echo ""
( set -x; spctl -vvv --assess --type exec ${APP_PATH} )
echo ""
( set -x; codesign -vvv --deep --strict ${APP_PATH} )
echo ""
( set -x; codesign -dvv ${APP_PATH} )
echo ""
echo "Making zips and appcast for ${GREEN}${SHORT_VERSION_STRING} (${VERSION})${NC}..."
# Make output dir (if necessary) and clear its contents.
rm -frd "${DEST_DIR}"
mkdir -p "${DEST_DIR}"
# Compress Itsycal.app and make a copy without version suffix.
ditto -c -k --sequesterRsrc --keepParent "${APP_PATH}" "${ZIP_PATH1}"
cp "${ZIP_PATH1}" "${ZIP_PATH2}"
# Get EdDSA signature (with private key in Keychain) and file size.
EDDSA_AND_FILESIZE=$(../Sparkle-1.27.1/bin/sign_update "${ZIP_PATH1}")
# On error, sign_update returns a message starting with "ERROR".
if [[ ${EDDSA_AND_FILESIZE} == ERROR* ]]
then
echo
echo "${RED}${EDDSA_AND_FILESIZE}${NC}"
echo
exit 1
fi
DATE=$(TZ=GMT date)
# Make the Sparkle appcast XML file.
cat > "${XML_PATH}" <<EOF
<?xml version="1.0" encoding="utf-8"?>
<rss
version="2.0"
xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"
xmlns:dc="http://purl.org/dc/elements/1.1/" >
<channel>
<title>Itsycal Release Notes</title>
<link>https://s3.amazonaws.com/itsycal/itsycal.xml</link>
<description>Most recent changes</description>
<language>en</language>
<item>
<title>Version ${SHORT_VERSION_STRING}</title>
<sparkle:minimumSystemVersion>11.0</sparkle:minimumSystemVersion>
<sparkle:releaseNotesLink>https://itsycal.s3.amazonaws.com/releasenotes.html</sparkle:releaseNotesLink>
<pubDate>${DATE} +0000</pubDate>
<enclosure
url="https://s3.amazonaws.com/itsycal/${ZIP_NAME}"
${EDDSA_AND_FILESIZE}
sparkle:version="${VERSION}"
sparkle:shortVersionString="${SHORT_VERSION_STRING}"
type="application/octet-stream" />
</item>
</channel>
</rss>
EOF
echo "Done!"
echo ""
open -R "${DEST_DIR}/itsycal.xml"