зеркало из https://github.com/mozilla/treeherder.git
32 строки
1.6 KiB
Bash
Executable File
32 строки
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script is for running tasks that are 'build' rather than 'release' specific:
|
|
# https://devcenter.heroku.com/articles/runtime-principles#build-release-run
|
|
# It is run automatically at the end of the Heroku Python buildpack's compile steps,
|
|
# which is after pip install and Django collectstatic have been run.
|
|
# NB: No changes to external services should be made here (use `pre_deploy` instead).
|
|
|
|
# Make non-zero exit codes & other errors fatal.
|
|
set -euo pipefail
|
|
|
|
# Make the current Git revision accessible at <site-root>/revision.txt
|
|
export REVISION=${SOURCE_VERSION:-$(git rev-parse HEAD)}
|
|
echo "$REVISION" > .build/revision.txt
|
|
echo "This is the revision of the build: $REVISION"
|
|
|
|
# Generate gzipped versions of files that would benefit from compression, that
|
|
# WhiteNoise can then serve in preference to the originals. This is required
|
|
# since WhiteNoise's Django storage backend only gzips assets handled by
|
|
# collectstatic, and so does not affect files in the `.build/` directory
|
|
# since they are instead generated by Neutrino/webpack.
|
|
python -m whitenoise.compress .build
|
|
|
|
# Remove nodejs files created by the Heroku Nodejs buildpack, to reduce slug size
|
|
# (and avoid environment variable pollution from the nodejs profile script), since
|
|
# they are no longer required after `yarn heroku-postbuild` has run. The buildpack
|
|
# cache will still contain them, so this doesn't slow down the next slug compile.
|
|
# Only delete if running as part of Heroku because the Travis run takes too long to delete it
|
|
if [[ -d .heroku/ ]]; then
|
|
rm -r .heroku/node/ .heroku/yarn/ .profile.d/nodejs.sh node_modules/
|
|
fi
|