forked from cocos2d/cocos2d-x-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_cron.sh
executable file
·386 lines (346 loc) · 12.6 KB
/
deploy_cron.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#!/bin/sh
# This script builds: Cocos2d-x-docs, Cocos Creator Manual, Cocos Creator API-Ref.
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/creator
# First Cocos2d-x docs, we are aready in this repo when executing this script
## pull latest from github
echo "***********************************************"
echo "Cocos2d-x Docs -- pulling latest from GitHub..."
echo "***********************************************"
git checkout master
#if (git pull origin master | grep -q "$git_string"); then
# echo "*** Cocos2d-x skipped, GitHub repo up to date... ***"
#else
echo "Building Cocos2d-x docs..."
git pull origin master
cp -rf config/cocos2d-x.org/. ./
## make sure gitbook is up to date
echo "Cocos2d-x-docs -- ensuring GitBook is up to date..."
gitbook install
## build it
echo "Cocos2d-x-docs -- building GitBook docs...."
gitbook build
## copy some needed files
echo "Cocos2d-x-docs -- 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 -- copy everything to deployment directory..."
mv _book/ cocos2d-x/
rsync --recursive cocos2d-x ../documentation
rm -rf cocos2d-x/
git stash
#fi
echo "************************"
echo "Cocos Creator Manuals..."
echo "************************"
## pull latest from github
echo "Cocos Creator -- preparing to build documentation..."
cd ../creator-docs
rm -rf node_modules/
## pulling v1.9
echo "--------------------------------"
echo "Cocos Creator -- pulling v1.9..."
echo "--------------------------------"
git checkout v1.9
if (git pull origin v1.9 | grep -q "$git_string"); then
echo "*** Cocos Creator v1.9 skipped, GitHub repo up to date... ***"
else
#git pull origin v1.9
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator v1.9 -- building GitBook docs...."
echo "If this is your first time build this repo, please stop this process and run:"
echo "npm install gulp -g"
echo "npm install"
echo "DO NOT COMMIT: package-lock.json"
npm install gulp -g
npm install
echo "Cocos Creator v1.9 -- ensuring GitBook is up to date..."
gitbook install
npm run build
echo "Cocos Creator v1.9 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ manual/
rsync --recursive manual ../documentation/creator/1.9
rm -rf manual/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator -- v1.9 done"
echo "---------------------------------"
## pulling v1.10
echo "---------------------------------"
echo "Cocos Creator -- pulling v1.10..."
echo "---------------------------------"
git checkout v1.10
if (git pull origin v1.10 | grep -q "$git_string"); then
echo "*** Cocos Creator v1.10 skipped, GitHub repo up to date... ***"
else
#git pull origin v1.10
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator v1.10 -- building GitBook docs...."
echo "If this is your first time build this repo, please stop this process and run:"
echo "npm install gulp -g"
echo "npm install"
echo "DO NOT COMMIT: package-lock.json"
npm install gulp -g
npm install
echo "Cocos Creator v1.10 -- ensuring GitBook is up to date..."
gitbook install
npm run build
echo "Cocos Creator v1.10 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ manual/
rsync --recursive manual ../documentation/creator/1.10
rm -rf manual/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator -- v1.10 done"
echo "---------------------------------"
## pulling 2.0.x version
echo "---------------------------------"
echo "Cocos Creator -- pulling v2.0.x.."
echo "---------------------------------"
git checkout v2.0
if (git pull origin v2.0 | grep -q "$git_string"); then
echo "*** Cocos Creator v2.x skipped, GitHub repo up to date... ***"
else
#git pull origin v2.0
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator v2.x-- building GitBook docs...."
echo "If this is your first time build this repo, please stop this process and run:"
echo "npm install gulp -g"
echo "npm install"
echo "DO NOT COMMIT: package-lock.json"
npm install gulp -g
npm install
echo "Cocos Creator v2.x -- ensuring GitBook is up to date..."
gitbook install
npm run build
echo "Cocos Creator v2.x -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ manual/
rsync --recursive manual ../documentation/creator/2.0
rsync --recursive manual ../documentation/creator/
rm -rf manual/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator - v2.0.x done"
echo "---------------------------------"
## pulling 2.10 version
echo "---------------------------------"
echo "Cocos Creator -- pulling v2.1...."
echo "---------------------------------"
git checkout v2.1
if (git pull origin v2.1 | grep -q "$git_string"); then
echo "*** Cocos Creator v2.1.x skipped, GitHub repo up to date... ***"
else
#git pull origin v2.1
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator v2.1.x -- building GitBook docs...."
echo "If this is your first time build this repo, please stop this process and run:"
echo "npm install gulp -g"
echo "npm install"
echo "DO NOT COMMIT: package-lock.json"
npm install gulp -g
npm install
echo "Cocos Creator v2.1.x -- ensuring GitBook is up to date..."
gitbook install
npm run build
echo "Cocos Creator v2.1.x -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ manual/
rsync --recursive manual ../documentation/creator/2.1
rm -rf manual/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator - v2.1 done"
echo "---------------------------------"
## pulling 2.2 version
echo "---------------------------------"
echo "Cocos Creator -- pulling v2.2...."
echo "---------------------------------"
git checkout v2.2
if (git pull origin v2.2 | grep -q "$git_string"); then
echo "*** Cocos Creator v2.2 skipped, GitHub repo up to date... ***"
else
#git pull origin v2.2
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator v2.2.x -- building GitBook docs...."
echo "If this is your first time build this repo, please stop this process and run:"
echo "npm install gulp -g"
echo "npm install"
echo "DO NOT COMMIT: package-lock.json"
npm install gulp -g
npm install
echo "Cocos Creator v2.2.x -- ensuring GitBook is up to date..."
gitbook install
npm run build
echo "Cocos Creator v2.2.x -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ manual/
rsync --recursive manual ../documentation/creator/2.2
rm -rf manual/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator - v2.2 done"
echo "---------------------------------"
echo "************************"
echo "Cocos Creator API-Ref..."
echo "************************"
echo "Cocos Creator API -- preparing to build documentation..."
cd ../creator-api-docs
rm -rf node_modules/
echo "---------------------------------"
echo "Cocos Creator API - v1.9... "
echo "---------------------------------"
git checkout v1.9
if (git pull origin v1.9 | grep -q "$git_string"); then
echo "*** Cocos Creator API v1.9 skipped, GitHub repo up to date... ***"
else
#git pull origin v1.9
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator API v1.9 -- ensuring GitBook is up to date..."
gitbook install
echo "Cocos Creator API v1.9 -- building GitBook docs...."
gitbook build
echo "Cocos Creator API v1.9 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ v1.9/
rsync --recursive v1.9 ../documentation/api-ref/creator
mv v1.9/ api/
rsync --recursive api ../documentation/creator/1.9
rm -rf api/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator API - v1.9 done"
echo "---------------------------------"
echo "---------------------------------"
echo "Cocos Creator API - v1.10..."
echo "---------------------------------"
git checkout v1.10
if (git pull origin v1.10 | grep -q "$git_string"); then
echo "*** Cocos Creator API v1.10 skipped, GitHub repo up to date... ***"
else
#git pull origin v1.10
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator API v1.10 -- ensuring GitBook is up to date..."
gitbook install
echo "Cocos Creator API v1.10 -- building GitBook docs...."
gitbook build
echo "Cocos Creator API v1.10 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ v1.10/
rsync --recursive v1.10 ../documentation/api-ref/creator
mv v1.10/ api/
rsync --recursive api ../documentation/creator/1.10
rm -rf api/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator API - v1.10 done"
echo "---------------------------------"
echo "---------------------------------"
echo "Cocos Creator API - v2.0.x..."
echo "---------------------------------"
git checkout v2.0
if (git pull origin v2.0 | grep -q "$git_string"); then
echo "*** Cocos Creator API v2.0 skipped, GitHub repo up to date... ***"
else
#git pull origin v2.0
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator API v2.0 -- ensuring GitBook is up to date..."
gitbook install
echo "Cocos Creator API v2.0 -- building GitBook docs...."
gitbook build
echo "Cocos Creator API v2.0 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ api/
rsync --recursive api ../documentation/creator/
rsync --recursive api ../documentation/creator/2.0/
mv api/ v2.0/
rsync --recursive v2.0 ../documentation/api-ref/creator
rm -rf v2.0/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator API - v2.0.x"
echo "---------------------------------"
echo "---------------------------------"
echo "Cocos Creator API - v2.1..."
echo "---------------------------------"
git checkout v2.1
if (git pull origin v2.1 | grep -q "$git_string"); then
echo "*** Cocos Creator API v2.1 skipped, GitHub repo up to date... ***"
else
#git pull origin v2.1
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator API v2.1 -- ensuring GitBook is up to date..."
gitbook install
echo "Cocos Creator API v2.1 -- building GitBook docs...."
gitbook build
echo "Cocos Creator API v2.1 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ v2.1/
rsync --recursive v2.1 ../documentation/api-ref/creator
mv v2.1/ api/
rsync --recursive api ../documentation/creator/2.1
rm -rf api/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator API - v2.1 done"
echo "---------------------------------"
echo "---------------------------------"
echo "Cocos Creator API - v2.2..."
echo "---------------------------------"
git checkout v2.2
if (git pull origin v2.2 | grep -q "$git_string"); then
echo "*** Cocos Creator API v2.2 skipped, GitHub repo up to date... ***"
else
#git pull origin v2.2
cp -rf config/cocos2d-x.org/. ./
echo "Cocos Creator API v2.2 -- ensuring GitBook is up to date..."
gitbook install
echo "Cocos Creator API v2.2 -- building GitBook docs...."
gitbook build
echo "Cocos Creator API v2.2 -- copy everything to deployment directory..."
cp ../cocos2d-x-docs/redirect.html.en _book/index.html
mv _book/ v2.2/
rsync --recursive v2.2 ../documentation/api-ref/creator
mv v2.2/ api/
rsync --recursive api ../documentation/creator/2.2
rm -rf api/
git stash
fi
echo "---------------------------------"
echo "Cocos Creator API - v2.2 done"
echo "---------------------------------"
cd ..