forked from ShareIt-project/ShareIt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·63 lines (47 loc) · 1.31 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
#!/usr/bin/env sh
# Simple script to deploy ShareIt! automatically to the different static web
# hostings and have all of them updated.
#
# It will be of none interest for you since it's only purposed for internal use
PRODUCTION_BRANCH="gh-pages"
PRODUCTION_REMOVE="doc test_images COLLABORATE.md deploy.sh README.md lib/README.md"
echo
echo "* Looking for remote changes on master branch *"
git checkout master
git pull --ff-only
status=$?
if [ $status -ne 0 ];then
echo "* There was a problem pulling from master *"
echo "* Probably a non fast-forward merge *"
exit $status
fi
echo
echo "* Push changes to GitHub master branch *"
git push origin master
echo
echo "* Update changes on production branch (gh-pages) *"
git checkout $PRODUCTION_BRANCH
status=$?
if [ $status -ne 0 ];then
echo "* There was a problem doing checkout *"
echo "* Probably a non staged file *"
exit $status
fi
git merge master
status=$?
if [ $status -ne 0 ];then
rm -rf $PRODUCTION_REMOVE
git commit -a --no-edit --allow-empty-message
fi
# Come back to master branch
git checkout master
echo
echo "* Deploy in GitHub *"
git push origin $PRODUCTION_BRANCH
echo
echo "* Deploy to 5Apps *"
git push 5apps $PRODUCTION_BRANCH:master
echo
echo "* Clean local repository *"
git gc --aggressive
git clean -n -d