-
Notifications
You must be signed in to change notification settings - Fork 486
/
post_compile
29 lines (22 loc) · 1.12 KB
/
post_compile
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
#!/usr/bin/env bash
set -eo pipefail
echo "-----> Post-compile hook"
if [ -f bin/run_collectstatic ] && [ -n "$ENABLE_DJANGO_COLLECTSTATIC" ] && [ "$ENABLE_DJANGO_COLLECTSTATIC" == 1 ]; then
echo "-----> Running run_collectstatic"
chmod +x bin/run_collectstatic
bin/run_collectstatic
fi
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
MANAGE_FILE=${MANAGE_FILE:2}
echo "-----> Running manage.py check --deploy --fail-level WARNING"
python $MANAGE_FILE check --deploy --fail-level WARNING
if [ -n "$AUTO_MIGRATE" ] && [ "$AUTO_MIGRATE" == 1 ]; then
echo "-----> Running manage.py migrate"
python $MANAGE_FILE migrate --noinput
fi
echo "-----> Pushing source maps to Sentry"
if [ -n "$SENTRY_API_KEY" ] && [ -n "$SENTRY_ORG" ] && [ -n "$SENTRY_PROJECT_NAME" ] && [ -n "$SOURCE_VERSION" ]; then
npx @sentry/cli --auth-token=$SENTRY_API_KEY releases --org=$SENTRY_ORG --project=$SENTRY_PROJECT_NAME files $SOURCE_VERSION upload-sourcemaps ./frontend/webpack_bundles/ --url-prefix "~/static/webpack_bundles/" --rewrite
rm ./frontend/webpack_bundles/*.js.map
fi
echo "-----> Post-compile done"