forked from billryan/algorithm-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
93 lines (87 loc) · 3.34 KB
/
Copy path.travis.yml
File metadata and controls
93 lines (87 loc) · 3.34 KB
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
language: node_js
node_js:
- "stable"
before_install:
# update first
- sudo apt-get update -qq
# install sshpass
- sudo apt-get install -y sshpass
# install Chinese fonts
- sudo apt-get install -y fonts-arphic-gbsn00lp fonts-arphic-bsmi00lp
# Install Gitbook
- npm install gitbook-cli -g
- npm install svgexport -g
# Clone the repository
- cd ~
- git clone --depth=10 --branch=master git://github.com/billryan/algorithm-exercise.git
before_script:
# install calibre latest version
- sudo -v && wget --no-check-certificate -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()"
# install qiniu sync
- wget http://devtools.qiniu.io/qiniu-devtools-linux_amd64-current.tar.gz
- tar xfz qiniu-devtools-linux_amd64-current.tar.gz
- cp algorithm-exercise/conf/qiniu_sync.json ~/
script:
# replace with real key
- sed -i "s/AccessKey/$QAK/g" qiniu_sync.json
- sed -i "s/SecretKey/$QSK/g" qiniu_sync.json
- mkdir -p ~/upload
# build static website
- cd ~/algorithm-exercise/
- gitbook install && gitbook build .
# build Simplified Chinese pdf
- cd ~/algorithm-exercise/zh-cn
#- gitbook install
# - gitbook build ./ --format=json
# - gitbook build ./
- gitbook pdf ./ ~/upload/algorithm_zh-cn_billryan_print.pdf
# - gitbook epub ./ ~/upload/algorithm_billryan.epub
# - gitbook mobi ./ ~/upload/algorithm_billryan.mobi
# build Traditional Chinese pdf
- cd ~/algorithm-exercise/zh-tw
- gitbook pdf ./ ~/upload/algorithm_zh-tw_billryan_print.pdf
# build English version pdf
- cd ~/algorithm-exercise/en
- gitbook pdf ./ ~/upload/algorithm_en_billryan_print.pdf
after_success:
# copy website html files to upload
# - tar czf algorithm_billryan_html.tar.gz _book/
# - cp algorithm_billryan_html.tar.gz ~/upload/
# upload to qiniu
- ~/qrsync ~/qiniu_sync.json
# upload to VPS
- rsync -a --rsh="/usr/bin/sshpass -p $FTP_PASSWORD ssh -p $FTP_PORT -o StrictHostKeyChecking=no -l $FTP_USER" ~/algorithm-exercise/_book/ $FTP_USER@ftp.yuanbin.me:/home/$FTP_USER/ftp/docs/algorithm
# # cd ~
# - cd ~
# # install source code pro
# - mkdir -p /tmp/code_pro
# - cd /tmp/code_pro/
# - wget https://github.com/adobe-fonts/source-code-pro/archive/1.017R.tar.gz
# - tar xzf 1.017R.tar.gz
# - mkdir -p ~/.fonts/fontconfig/conf.d/
# - cp source-code-pro-1.017R/OTF/*.otf ~/.fonts/
# - sudo fc-cache -f -v
# # install google noto Simplified Chinese
# - mkdir -p /tmp/noto
# - cd /tmp/noto
# - wget https://www.google.com/get/noto/pkgs/NotoSansCJKSC-hinted.zip
# - https://www.google.com/get/noto/pkgs/NotoSerif-unhinted.zip
# - unzip NotoSansCJKSC-hinted.zip
# - unzip NotoSerif-unhinted.zip
# - mkdir -p ~/.fonts/noto
# - mv *.otf ~/.fonts/noto
# # update fonts
# - cd ~
# - cp ~/algorithm-exercise/conf/10-latin.conf ~/.fonts/fontconfig/conf.d/
# - cp ~/algorithm-exercise/conf/15-noto-cjksc.conf ~/.fonts/fontconfig/conf.d/
# - cp ~/algorithm-exercise/conf/20-noto-cjk.conf ~/.fonts/fontconfig/conf.d/
# - sudo fc-cache -f -v
# # generate different locales
# - sudo locale-gen zh_CN.UTF-8
# - cd ~/algorithm-exercise
# - export LANG=zh_CN.UTF-8
# - gitbook pdf ./ ~/upload/algorithm_billryan_desktop.pdf
# - ~/qrsync ~/qiniu_sync.json
branches:
only:
- master