-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
56 lines (41 loc) · 1.1 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
#!/bin/bash
test_mode=false
if [[ "$1" == "test" ]] || [[ "$3" == "test" ]]; then
test_mode=true
fi
if [[ false == $test_mode ]]; then
set -o errexit -o nounset
if [ "$TRAVIS_BRANCH" != "master" ]
then
echo "This commit was made against the $TRAVIS_BRANCH and not the master! No deploy!"
exit 0
fi
rev=$(git rev-parse --short HEAD)
mkdir deploy
cd deploy
echo $GH_TOKEN | cut -c1-5
git init
git config user.name "Travis"
git config user.email "[email protected]"
git remote add origin "https://[email protected]/Asenar/possedex-website"
else
echo "Push cancelled (test mode)"
fi
git fetch origin
git reset --hard origin/master
python fetch-mdiplo.py
changes=$(git status -uno -s)
if [[ -n $changes ]]; then
date=$(date)
# git add docs/database.json
# git add docs/mdiplo.json
git add docs/db.json
git commit -m"Update with $rev ($date)"
if [[ false == $test_mode ]]; then
git push origin master:master
else
echo "Push cancelled (test mode)"
fi
else
echo "Aucun changement détecté"
fi