forked from OI-wiki/OI-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
49 lines (49 loc) · 1.57 KB
/
.travis.yml
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
language: python
cache:
pip: true
directories:
- node_modules
python:
- 3.6
services:
- docker
before_install:
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
- source ~/.nvm/nvm.sh
- nvm install 10.9
install:
- pip install -r requirements.txt
- npm install .
script:
- set -e
- chmod +x ./scripts/build.sh && ./scripts/build.sh
- mkdocs build -v
- find ./site -type f -name '*.html' -exec node --max_old_space_size=512 ./scripts/render_math.js {} \;
- npx gulp minify
- set +e
deploy:
provider: pages
skip_cleanup: true
github-token: $GH_TOKEN
local-dir: site
on:
branch: master
after_deploy:
- chmod +x scripts/BaiduPusher.sh && ./scripts/BaiduPusher.sh
- cd /tmp
- git clone https://github.com/OI-wiki/OI-wiki.git
- cd OI-wiki
- git remote add coding https://$CODING_USER:$CODING_KEY@git.coding.net/scaffrey/OI-wiki.git
- git push coding master:master -f
- git fetch origin gh-pages
- git checkout -b gh-pages origin/gh-pages
- git push coding gh-pages:gh-pages -f
- git checkout -b cdn-pages origin/gh-pages
- find ./ -type f -name "*.html" -exec sed -i -E 's/([^"]*)(assets[^"]*)/https:\/\/cdn-for-oi-wiki.billchn.com\/\2/g' {} +
- git add .
- git config user.name "Travis Builder"
- git config user.email "hi@oi-wiki.org"
- git commit --author "24OI-bot <15963390+24OI-bot@users.noreply.github.com>" -m "build cdn files"
- git remote add gh-token "https://${GH_TOKEN}@github.com/OI-wiki/OI-wiki.git";
- git push gh-token cdn-pages -f
- git push coding cdn-pages:coding-pages -f