2016-12-01 20:33:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: $0 -v <version> -c <config file> [-n]"
|
|
|
|
echo
|
|
|
|
echo "version: commit-ish to check out and build"
|
|
|
|
echo "config file: a path to a json config file to"
|
|
|
|
echo "ship with the build. In addition, update_base_url:"
|
|
|
|
echo "from this file is used to set up auto-update."
|
|
|
|
echo "-n: build with no config file."
|
|
|
|
echo
|
|
|
|
echo "Values may also be passed as environment variables"
|
|
|
|
}
|
|
|
|
|
|
|
|
conffile=
|
|
|
|
version=
|
|
|
|
skipcfg=0
|
|
|
|
while getopts "c:v:n" opt; do
|
|
|
|
case $opt in
|
|
|
|
c)
|
|
|
|
conffile=$OPTARG
|
|
|
|
;;
|
|
|
|
v)
|
|
|
|
version=$OPTARG
|
|
|
|
;;
|
|
|
|
n)
|
|
|
|
skipcfg=1
|
|
|
|
;;
|
|
|
|
\?)
|
|
|
|
echo "Invalid option: -$OPTARG" >&2
|
|
|
|
usage
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$version" ]; then
|
|
|
|
echo "No version supplied"
|
|
|
|
usage
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$conffile" ] && [ "$skipcfg" = 0 ]; then
|
|
|
|
echo "No config file given. Use -c to supply a config file or"
|
|
|
|
echo "-n to build with no config file (and no auto update)."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$conffile" ]; then
|
|
|
|
update_base_url=`jq -r .update_base_url $conffile`
|
|
|
|
|
|
|
|
if [ -z "$update_base_url" ]; then
|
|
|
|
echo "No update URL supplied. Use update_base_url: null if you really"
|
|
|
|
echo "want a build with no auto-update."
|
|
|
|
usage
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
# Make sure the base URL ends in a slash if it doesn't already
|
|
|
|
update_base_url=`echo $update_base_url | sed -e 's#\([^\/]\)$#\1\/#'`
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f package.json ]; then
|
|
|
|
echo "No package.json found. This script must be run from"
|
2017-05-11 18:49:31 +02:00
|
|
|
echo "the riot-web directory."
|
2016-12-01 20:33:42 +01:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Building $version using Update base URL $update_base_url"
|
|
|
|
|
|
|
|
projdir=`pwd`
|
|
|
|
builddir=`mktemp -d 2>/dev/null || mktemp -d -t 'buildtmp'`
|
|
|
|
pushd "$builddir"
|
2016-12-09 19:29:54 +01:00
|
|
|
|
2016-12-01 20:33:42 +01:00
|
|
|
git clone "$projdir" .
|
|
|
|
git checkout "$version"
|
|
|
|
|
2016-12-09 21:23:19 +01:00
|
|
|
# Figure out what version we're building
|
|
|
|
vername=`jq -r .version package.json`
|
|
|
|
|
2016-12-01 20:33:42 +01:00
|
|
|
if [ -n "$conffile" ]; then
|
|
|
|
popd
|
|
|
|
cp "$conffile" "$builddir/"
|
|
|
|
pushd "$builddir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
npm install
|
|
|
|
npm run build:electron
|
|
|
|
|
|
|
|
popd
|
|
|
|
|
2017-05-10 14:36:27 +02:00
|
|
|
distdir="$builddir/electron_app/dist"
|
|
|
|
pubdir="$projdir/electron_app/pub"
|
2016-12-01 20:33:42 +01:00
|
|
|
rm -r "$pubdir" || true
|
|
|
|
mkdir -p "$pubdir"
|
2017-09-06 15:37:57 +02:00
|
|
|
rm -r "$projdir/electron_app/dist" || true
|
2017-09-06 14:28:21 +02:00
|
|
|
mkdir -p "$projdir/electron_app/dist/unsigned/"
|
2016-12-01 20:33:42 +01:00
|
|
|
|
|
|
|
# Install packages: what the user downloads the first time,
|
|
|
|
# (DMGs for mac, exe installer for windows)
|
|
|
|
mkdir -p "$pubdir/install/macos"
|
2018-10-16 11:26:04 +02:00
|
|
|
cp $distdir/*.dmg "$pubdir/install/macos/"
|
2016-12-01 20:33:42 +01:00
|
|
|
|
2017-09-06 14:28:21 +02:00
|
|
|
# Windows installers go to the dist dir because they need signing
|
2016-12-05 15:08:27 +01:00
|
|
|
mkdir -p "$pubdir/install/win32/ia32/"
|
2019-02-14 14:13:53 +01:00
|
|
|
mkdir -p "$projdir/electron_app/dist/unsigned/ia32/"
|
2019-02-14 14:05:49 +01:00
|
|
|
cp $distdir/squirrel-windows-ia32/*.exe "$projdir/electron_app/dist/unsigned/ia32/"
|
2016-12-05 15:08:27 +01:00
|
|
|
|
|
|
|
mkdir -p "$pubdir/install/win32/x64/"
|
2019-02-14 14:13:53 +01:00
|
|
|
mkdir -p "$projdir/electron_app/dist/unsigned/x64/"
|
2019-02-14 14:05:49 +01:00
|
|
|
cp $distdir/squirrel-windows/*.exe "$projdir/electron_app/dist/unsigned/x64/"
|
2016-12-01 20:33:42 +01:00
|
|
|
|
2016-12-05 15:08:27 +01:00
|
|
|
# Packages for auto-update
|
2016-12-01 20:33:42 +01:00
|
|
|
mkdir -p "$pubdir/update/macos"
|
2018-10-16 11:26:04 +02:00
|
|
|
cp $distdir/*-mac.zip "$pubdir/update/macos/"
|
2016-12-09 19:29:54 +01:00
|
|
|
echo "$vername" > "$pubdir/update/macos/latest"
|
2016-12-01 20:33:42 +01:00
|
|
|
|
2016-12-05 15:08:27 +01:00
|
|
|
mkdir -p "$pubdir/update/win32/ia32/"
|
2019-02-14 13:54:26 +01:00
|
|
|
cp $distdir/squirrel-windows-ia32/*.nupkg "$pubdir/update/win32/ia32/"
|
|
|
|
cp $distdir/squirrel-windows-ia32/RELEASES "$pubdir/update/win32/ia32/"
|
2016-12-05 15:08:27 +01:00
|
|
|
|
|
|
|
mkdir -p "$pubdir/update/win32/x64/"
|
2019-02-14 13:54:26 +01:00
|
|
|
cp $distdir/squirrel-windows/*.nupkg "$pubdir/update/win32/x64/"
|
|
|
|
cp $distdir/squirrel-windows/RELEASES "$pubdir/update/win32/x64/"
|
2016-12-05 15:08:27 +01:00
|
|
|
|
2019-03-07 12:12:43 +01:00
|
|
|
# Move the deb to the main project dir's dist folder
|
|
|
|
# (just the 64 bit one - the 32 bit one still gets built because
|
|
|
|
# it's one arch argument for all platforms and we still want 32 bit
|
|
|
|
# windows, but 32 bit linux is unsupported as of electron 4 and no
|
|
|
|
# longer appears to work).
|
|
|
|
cp $distdir/*_amd64.deb "$projdir/electron_app/dist/"
|
2016-12-01 20:33:42 +01:00
|
|
|
|
|
|
|
rm -rf "$builddir"
|
|
|
|
|
2017-09-06 14:28:21 +02:00
|
|
|
echo "Unsigned Windows installers have been placed in electron_app/dist/unsigned/ - sign them,"
|
|
|
|
echo "or just copy them to "$pubdir/install/win32/\<arch\>/""
|
|
|
|
echo "Once you've done this, $pubdir can be hosted on your web server."
|
2017-05-10 14:36:27 +02:00
|
|
|
echo "deb archives are in electron_app/dist/ - these should be added into your debian repository"
|