forked from jpush/jpush-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautobuild.py
68 lines (52 loc) · 2.18 KB
/
autobuild.py
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
#!/usr/bin/env python
import logging
import commands
import os
import time
# git pull from remote
def git_pull():
print (os.chdir("/opt/push/jpush-docs/jpush-docs/"))
logging.info(commands.getstatusoutput("git pull origin master"))
print ("git pull origin master")
# build docs
def build():
logging.info(os.chdir("/opt/push/jpush-docs/jpush-docs/zh/JPush/"))
print ("JPush/")
logging.info (commands.getstatusoutput("/opt/push/jpush-docs/venv/bin/mkdocs build"))
time.sleep(1)
print time.asctime(time.localtime(time.time()))
logging.info (os.chdir("/opt/push/jpush-docs/jpush-docs/zh/JAnalytics/"))
print ("JAnalytics/")
logging.info(commands.getstatusoutput("/opt/push/jpush-docs/venv/bin/mkdocs build"))
time.sleep(1)
print time.asctime(time.localtime(time.time()))
logging.info(os.chdir("/opt/push/jpush-docs/jpush-docs/zh/JMessage/"))
print ("JMessage/")
logging.info (commands.getstatusoutput("/opt/push/jpush-docs/venv/bin/mkdocs build"))
time.sleep(1)
print time.asctime(time.localtime(time.time()))
logging.info (os.chdir("/opt/push/jpush-docs/jpush-docs/zh/JSMS/"))
print ("JSMS/")
logging.info (commands.getstatusoutput("/opt/push/jpush-docs/venv/bin/mkdocs build"))
time.sleep(1)
print time.asctime(time.localtime(time.time()))
logging.info (os.chdir("/opt/push/jpush-docs/jpush-docs/zh/JShare/"))
print ("JShare/")
logging.info (commands.getstatusoutput("/opt/push/jpush-docs/venv/bin/mkdocs build"))
time.sleep(1)
print time.asctime(time.localtime(time.time()))
logging.info (os.chdir("/opt/push/jpush-docs/jpush-docs/zh/Index/"))
print ("Index/")
logging.info (commands.getstatusoutput("/opt/push/jpush-docs/venv/bin/mkdocs build"))
time.sleep(1)
print time.asctime(time.localtime(time.time()))
# logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='/opt/push/jpush-docs/autobuild.log',
filemode='a+')
git_pull()
build()
print time.asctime(time.localtime(time.time()))
exit()