forked from City-of-Helsinki/parkkihubi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-update
executable file
·43 lines (37 loc) · 1.19 KB
/
post-update
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
#!/bin/sh
set -e
# Read the environment variables
if [ -r ../etc/env ]; then
. ../etc/env
fi
# Update the dashboard
if [ "$DISABLE_DASHBOARD_DEPLOY" = "1" ]; then
echo "Not deploying Dashboard, since DISABLE_DASHBOARD_DEPLOY is set."
elif [ "$force_update" = "true" ] || \
git diff --name-only "$prev_head..HEAD" | grep -q "^dashboard/"; then
if [ "$TIER" != "prod" ]; then
export REACT_APP_API_URL="https://testapi.parkkiopas.fi/"
echo "Using API base URL: $REACT_APP_API_URL"
fi
cd dashboard
yarn install --production=false # dev deps are needed for @types packages
yarn run build
if [ -d ../../var ]; then
rsync -av --delete build/ ../../var/dashboard/
fi
cd ..
fi
# Update the backend
pip install -r requirements-pip.txt
pip install -r requirements-prequ.txt
prequ sync requirements.txt
./manage.py collectstatic --noinput
if [ "$DISABLE_MIGRATIONS_ON_DEPLOY" = "1" ]; then
echo "Skipping migrations, since DISABLE_MIGRATIONS_ON_DEPLOY is set."
else
./manage.py migrate --noinput
fi
# Send notification about succesful update
if [ -x ../bin/update-notify ]; then
../bin/update-notify "Successfully updated to $new_ver"
fi