-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy-cocos2dx.sh
executable file
·113 lines (92 loc) · 3.06 KB
/
deploy-cocos2dx.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
convert_to_integer() {
echo "$@" | awk -F "." '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
}
echo "**********************"
echo "Building Cocos Docs..."
echo "**********************"
echo "Hosekeeping..."
git_legacy=0
gitv1=2.7.4
git_string=0
git_version="$(git --version)"
git_version=${git_version#"git version "}
echo "Git version: "$git_version
if [ "$(convert_to_integer $git_version)" -gt "$(convert_to_integer $gitv1)" ];then
#echo "$git_version is greater than or equal to $gitv1"
git_legacy=0
git_string="Already up to date"
echo "Git version: modern"
else
git_legacy=1
git_string="Already up-to-date"
echo "Git version: legacy"
fi
mkdir -p documentation/
mkdir -p documentation/creator/
mkdir -p documentation/cocos2d-x/
cd cocos2d-x-docs/
echo "--------------------------------"
echo "Cocos2d-x -- pulling v3..."
echo "--------------------------------"
git checkout master
git reset --hard origin/master
#if (git pull origin master | grep -q "$git_string"); then
# echo "*** Cocos2d-x v3 skipped, GitHub repo up to date... ***"
#else
echo "Building Cocos2d-x v3 docs..."
#git pull origin master
cp -rf config/cocos2d-x.org/. ./
## make sure gitbook is up to date
echo "Cocos2d-x-docs v3 -- ensuring GitBook is up to date..."
gitbook install
## build it
echo "Cocos2d-x-docs v3 -- building GitBook docs...."
gitbook build
## copy some needed files
echo "Cocos2d-x-docs v3 -- copying needed files..."
cp redirect.html.en _book/index.html
cp index.html.en ../documentation/index.html
## copy everything to deployment directory
echo "Cocos2d-x-docs v3 -- copy everything to deployment directory..."
mv _book/ v3/
rsync --recursive v3 ../documentation/cocos2d-x
rm -rf v3/
#git stash
git reset --hard origin/master
#fi
echo "--------------------------------"
echo "Cocos2d-x -- pulling v4..."
echo "--------------------------------"
git checkout v4-docs
git reset --hard origin/v4-docs
#if (git pull origin v4-docs | grep -q "$git_string"); then
# echo "*** Cocos2d-x v4 skipped, GitHub repo up to date... ***"
#else
echo "Building Cocos2d-x v4 docs..."
#git pull origin v4-docs
cp -rf config/cocos2d-x.org/. ./
## make sure gitbook is up to date
echo "Cocos2d-x-docs v4 -- ensuring GitBook is up to date..."
gitbook install
## build it
echo "Cocos2d-x-docs v4 -- building GitBook docs...."
gitbook build
## copy some needed files
echo "Cocos2d-x-docs v4 -- copying needed files..."
cp redirect.html.en _book/index.html
#cp index.html.en ../documentation/index.html
## copy everything to deployment directory
echo "Cocos2d-x-docs v4 -- copy everything to deployment directory..."
mv _book/ v4/
rsync --recursive v4 ../documentation/cocos2d-x
rm -rf v4/
#git stash
git reset --hard origin/v4-docs
#fi
cd ..
echo "---------------------------------"
echo "Deploying to web-server location"
echo "---------------------------------"
echo "Copy to nginx location..."
rsync --recursive documentation /var/www