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
77 lines (70 loc) · 2.25 KB
/
.travis.yml
File metadata and controls
77 lines (70 loc) · 2.25 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
language: node_js
node_js:
- "stable"
before_install:
# add id_rsa private key
- openssl aes-256-cbc -K $encrypted_c2697660bfd7_key -iv $encrypted_c2697660bfd7_iv
-in id_rsa.enc -out ~/.ssh/id_rsa -d
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- cp ssh_config ~/.ssh/config
- git config --global user.name "billryan"
- git config --global user.email [email protected]
# update first
- sudo apt-get update -qq
- sudo apt-cache search fonts-noto-cjk
# Install Gitbook
- npm install gitbook-cli -g
- npm install svgexport -g
- cd ~
- git clone [email protected]:billryan/algorithm-exercise.git
- cp algorithm-exercise/scripts/rename_ebook.sh ~/
- chmod +x rename_ebook.sh
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()"
script:
- mkdir -p ~/upload
# install noto
- mkdir -p ~/fonts
- cd ~/fonts
- wget https://noto-website.storage.googleapis.com/pkgs/NotoSansCJKSC-hinted.zip
- wget https://noto-website.storage.googleapis.com/pkgs/NotoSansCJKTC-hinted.zip
- unzip -o NotoSansCJKSC-hinted.zip
- unzip -o NotoSansCJKTC-hinted.zip
- mkdir -p ~/.fonts/noto
- mv *.otf ~/.fonts/noto
- mkdir -p ~/.fonts/fontconfig/conf.d/
- cp ~/algorithm-exercise/conf/20-noto-cjk.conf ~/.fonts/fontconfig/conf.d/
- sudo fc-cache -f -v
# gitbook build
- cd ~/algorithm-exercise/
- gitbook install
- gitbook pdf .
- gitbook epub .
- gitbook mobi .
- mv *.pdf *.epub *.mobi ~/upload
- cd ~/upload
- sh ~/rename_ebook.sh
after_success:
- cd ~/algorithm-exercise
- git remote add gitcafe [email protected]:billryan/algorithm-exercise.git
- git push -u gitcafe HEAD:master --force
- git checkout deploy
- cp ~/upload/*.epub epub
- cp ~/upload/*.pdf pdf
- cp ~/upload/*.mobi mobi
- rm */*shared-files*
- git add epub pdf mobi
- git commit --amend -m "Updated $(date)"
- git push -u gitcafe HEAD:deploy --force
- git push -u origin HEAD:deploy --force
# blacklist
branches:
except:
- deploy
# whitelist
branches:
only:
- master