-
Notifications
You must be signed in to change notification settings - Fork 95
/
deploy.sh
executable file
·76 lines (54 loc) · 1.25 KB
/
deploy.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
export GIT_PAGER=cat
./pre-deploy.sh
# Abort when user not sure.
if [ $? -ne 0 ]; then
echo "[!] Halted in pre-deployment: Either user ABORTED or script FAILED"
exit;
fi
echo ""
echo ""
echo " --- Checking Python version."
./check_python_version.py
if [ $? -ne 0 ]; then
echo "[!] Aborting deployment due to Python version"
exit 1;
fi
echo ""
echo ""
echo " --- Checking for local file changes."
git diff --quiet
if [ $? -ne 0 ]; then
git status --porcelain
echo ""
echo "[!] Local file changes detected, aborting deployment"
echo " To revert all files to their default, WITHOUT backup, execute:"
echo ""
echo " git reset --hard HEAD"
echo ""
exit 1;
fi
echo ""
echo ""
echo " --- Pulling remote repository for new commits..."
git fetch
echo ""
echo ""
echo " --- Merging/updating checkout."
git merge FETCH_HEAD
echo ""
echo ""
echo " >>> Running post-deployment script. <<<"
./post-deploy.sh
# Abort on any error
if [ $? -ne 0 ]; then
echo "[!] Halted. Post-deployment script exited with non-zero code"
exit;
fi
echo ""
echo ""
echo " --- Deployed version: "
python -c 'import dsmrreader ; print(dsmrreader.__version__)'
echo ""
echo ""
echo " >>> Deployment complete. <<<"