-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate-release.sh
executable file
·111 lines (95 loc) · 5.13 KB
/
create-release.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
#
# create-release.sh x y z
#
# Grab the raw binaries and make the necessary modifications to create
# installers for each platform. Essentially, this downloads and
# extracts the main install contents and sets up the version
# number. After executing this, you need to run BitRock InstallBuilder
# and generate each of the installers, unless it can be found in your
# PATH, in which case it will be run automatically to build the
# packages.
VERSION_MAJOR=$1
VERSION_MINOR=$2
VERSION_REVISION=$3
VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}
VERSION_INT=$((${VERSION_MAJOR}*1000000 + ${VERSION_MINOR}*1000 + ${VERSION_REVISION}))
# Clean out any old data
rm -rf sirikata_win32
rm -rf sirikata_mac
rm -f sirikata-win32-autoupdate.exe
rm -rf sirikata-mac-autoupdate.app
rm -rf sirikata-${VERSION}-mac-installer.app
rm -f sirikata-${VERSION}-mac-installer.dmg
rm -f sirikata-${VERSION}-win32-installer.exe
# Grab and extract data
echo "Grabbing and extracting raw packages..."
([ -e sirikata-$VERSION-win32.zip ] || wget http://sirikata.com/releases/win32/sirikata-$VERSION-win32.zip) && \
unzip -q sirikata-$VERSION-win32.zip
([ -e sirikata-$VERSION-mac.tar.gz ] || wget http://sirikata.com/releases/mac/sirikata-$VERSION-mac.tar.gz) && \
tar -xzf sirikata-$VERSION-mac.tar.gz
# Make sure we have a copy of sirikata at the right version. We get
# the README and LICENSE from here currently.
([ -e sirikata.git ] || git clone git://github.com/sirikata/sirikata.git sirikata.git) && \
cd sirikata.git && \
git fetch origin && \
git checkout v${VERSION} && \
cd ..
# And grab the visual studio redistributable for the windows version
[ -e vcredist_x86.exe ] || wget http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe
# and the DirectX installer
[ -e dxwebsetup.exe ] || wget http://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe
# Generate a version-specific project file. When we can find the
# InstallBuilder binary, we could actually just use --setvars, but to
# support not having it in your PATH, we just generate a copy with the
# version set. Using a copy avoids accidentally checking in changes to
# this file.
sed "s/__VERSIONINT__/${VERSION_INT}/" sirikata.xml | sed "s/__VERSION__/${VERSION}/" > sirikata-$VERSION.xml
# And generate update.xml with correct version info for the server
sed "s/__VERSIONINT__/${VERSION_INT}/" update-template.xml | sed "s/__VERSION__/${VERSION}/" > update.xml
# Try to run InstallBuilder if we can find it
INSTALLBUILDER=`which builder`
if [ "x${INSTALLBUILDER}" == "x" ]; then
echo "Couldn't find InstallBuilder. You need to open sirikata-${VERSION}.xml manually and build the packages."
else
INSTALLBUILDER_BIN=`dirname ${INSTALLBUILDER}`
INSTALLBUILDER_BASE=`dirname ${INSTALLBUILDER_BIN}`
INSTALLBUILDER_AUTOUPDATE=${INSTALLBUILDER_BASE}/autoupdate/bin/customize.run
echo "Building autoupdaters"
${INSTALLBUILDER_AUTOUPDATE} build sirikata-autoupdate.xml windows
${INSTALLBUILDER_AUTOUPDATE} build sirikata-autoupdate.xml osx
echo "Copying to current directory..."
cp -r ${INSTALLBUILDER_BASE}/autoupdate/output/autoupdate-windows.exe sirikata-win32-autoupdate.exe
cp -r ${INSTALLBUILDER_BASE}/autoupdate/output/autoupdate-osx.app sirikata-mac-autoupdate.app
echo "Building installers for Windows and Mac..."
${INSTALLBUILDER} build sirikata-$VERSION.xml windows
${INSTALLBUILDER} build sirikata-$VERSION.xml osx
echo "Copying to current directory..."
# Copy installer app, works for both regular and update
cp -r `dirname ${INSTALLBUILDER}`/../output/Sirikata-${VERSION}-osx-installer.app sirikata-${VERSION}-mac-installer.app
# Generate dmg for regular installs -- the -root setting is just
# the name of the .app we create at the top level, which we rename
# here from the copy we have to make it clearer for users
genisoimage -D -V "sirikata-${VERSION}" -no-pad -r -apple -root "Install Sirikata ${VERSION}.app" -o sirikata-${VERSION}-mac-installer.dmg sirikata-${VERSION}-mac-installer.app
# Regular archive for updater
tar -czf sirikata-${VERSION}-mac-installer.tgz sirikata-${VERSION}-mac-installer.app
# Copy the windows installer
cp -r `dirname ${INSTALLBUILDER}`/../output/Sirikata-${VERSION}-windows-installer.exe sirikata-${VERSION}-win32-installer.exe
echo "Done"
rm sirikata-${VERSION}.xml
echo
echo
echo "*****************************"
echo
echo "Finished generating installers. You need to upload:"
echo " * the installer packages to sirikata.com/releases/[mac/win32]"
echo " * the update installer package (tgz version) for mac to sirikata.com/releases/mac"
echo " * update.xml to sirikata.com/releases/"
echo
echo " e.g."
echo " scp sirikata-${VERSION}-win32-installer.exe user@server:sirikata.com/releases/win32/"
echo " scp sirikata-${VERSION}-mac-installer.dmg user@server:sirikata.com/releases/mac/"
echo " scp sirikata-${VERSION}-mac-installer.tgz user@server:sirikata.com/releases/mac/"
echo " scp update.xml user@server:sirikata.com/releases/"
echo
fi