zulip/tools/build-enterprise-tarball

47 lines
1.1 KiB
Bash
Executable File

#!/bin/sh -ex
GITID=$(git rev-parse HEAD)
if [ "$(uname)" = "Darwin" ]; then
TMPDIR=/tmp/enterprise-build
rm -Rf $TMPDIR
mkdir -p $TMPDIR
else
TMPDIR=$(mktemp -d)
fi
TMP_CHECKOUT=$TMPDIR/zulip-server/
TARBALL=$TMPDIR/zulip-server.tar
# .gitattributes lists the files that are not exported
git archive -o $TARBALL --prefix=zulip-server/ HEAD
# Check out a temporary full copy of the index to generate static files
git checkout-index -f -a --prefix $TMP_CHECKOUT
cd $TMP_CHECKOUT
# Use default settings so there is no chance of leaking secrets
cp zproject/local_settings_template.py zproject/local_settings.py
# Some settings need values for it to work
cat >> zproject/local_settings.py <<EOF
DEBUG = False
LOCAL_DATABASE_PASSWORD = ''
SECRET_KEY = 'not_used_here'
EOF
# update-prod-static generates the prod-static directory.
# See COLLECTSTATIC in settings.py
./tools/update-prod-static
echo $GITID > version_id
mv update-prod-static.log ..
cd $TMPDIR
tar --append -f $TARBALL zulip-server/prod-static zulip-server/version_id
rm -r zulip-server
gzip $TARBALL
echo "Generated $TARBALL.gz"