-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·22 lines (18 loc) · 924 Bytes
/
deploy.sh
File metadata and controls
executable file
·22 lines (18 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
set -e
if !(git pull --quiet origin main && ([ -d "venv" ] || python3 -m venv venv) && \
source venv/bin/activate && pip install -r requirements.txt && \
python manage.py migrate --noinput && \
./node_modules/.bin/parcel build bundles-src/index.js --dist-dir bundles --public-url="./" \
&& python manage.py collectstatic --clear --noinput && systemctl restart star-burger);
then
exit_code=$?
echo "Something went wrong: exit code $exit_code" >&2
exit $exit_code
fi
deactivate
git_commit_id=$(git rev-parse --short HEAD)
rb_key=$(grep -i 'ROLLBAR_KEY=' /etc/systemd/system/star-burger.env | cut -f2 -d'=' | cut -f2 -d'"')
curl -H 'Content-Type: application/json' -H "X-Rollbar-Access-Token: $rb_key" --data "{\"environment\":
\"development\", \"revision\": \"$git_commit_id\", \"local_username\": \"django\"}" --request POST https://api.rollbar.com/api/1/deploy
echo "Deployment complete"