Skip to content

Commit

Permalink
Added Gitbook build config and Travis CI support
Browse files Browse the repository at this point in the history
  • Loading branch information
sabertazimi committed Jul 18, 2018
1 parent 3cada88 commit 27e639a
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
language: node_js

node_js:
- "8"

# 缓存依赖
cache:
directories:
- $HOME/.npm

before_install:
- export TZ='Asia/Shanghai' # 更改时区

# 依赖安装
install:
- npm install -g gitbook-cli gitbook-summary

# 构建脚本
script:
# 自定义输出目录 gitbook build src dest
- cd ./blog
- gitbook install
- book sm
- cat SUMMARY.md
- gitbook build . ../blog-build

# 分支白名单
branches:
only:
- master # 只对 master 分支进行构建

# GitHub Pages 部署
deploy:
provider: pages
skip_cleanup: true
# 在项目仪表盘的 Settings -> Environment Variables 中配置
github_token: $GITHUB_TOKEN
# 将 build 目录下的内容推送到默认的 gh-pages 分支上,并不会连带 build 目录一起
local_dir: blog-build
name: $GIT_NAME
email: $GIT_EMAIL
on:
branch: master
69 changes: 69 additions & 0 deletions blog/book.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"title": "Learn React Source Code",
"author": "cyan33",
"links": {
"sidebar": {
"Learn React Source Code": "https://github.com/cyan33/learn-react-source-code"
}
},
"plugins": [
"-lunr",
"-search",
"search-plus",
"splitter",
"anchors",
"anchor-navigation-ex",
"copy-code-button",
"expandable-chapters",
"theme-darkblue",
"theme-comscore",
"tbfed-pagefooter",
"prism",
"-highlight",
"github-buttons",
"edit-link",
"disqus"
],
"pluginsConfig": {
"tbfed-pagefooter": {
"modify_label": "最近更新:",
"modify_format": "YYYY-MM-DD HH:mm"
},
"prism": {
"css": [
"prismjs/themes/prism-tomorrow.css"
]
},
"github-buttons": {
"buttons": [{
"user": "cyan33",
"repo": "learn-react-source-code",
"type": "star",
"size": "small",
"count": true
}]
},
"edit-link": {
"base": "https://github.com/cyan33/learn-react-source-code/edit/master/blog",
"label": "Edit This Page"
},
"sharing": {
"facebook": false,
"twitter": true,
"weibo": true
},
"disqus": {
"shortName": "gitbook-8"
},
"anchor-navigation-ex": {
"multipleH1": false
}
},
"ignores": [
".*",
"build",
"_book",
"gitbook",
"node_modules"
]
}

0 comments on commit 27e639a

Please sign in to comment.