gitbook在私有gitlab上持续集成
1.在gitlab新建一个resposity
2.checkout到本地
3.在项目上新增一个.gitlab-ci.yml文件并提交到Gitlab,文件内容参考如下:
1)切换到gitlab项目目录下
cd /D c:\Users\NetEase\portus
2)在这个目录下新增.gitlab-ci.yml文件
before_script:
makedoc:
image: reg.kk17.net/gitbook:latest
script:
- gitbook build
- rsync-docs
// 使用tags匹配runner
tags:
- gitbook
3)增加以.md结尾的文档、SUMMARY.md和 README.md文件
4)本地测试
$git status
大概能看到包含.gitlab-ci.yml SUMMARY.md的一串东西
$echo _book > .gitignore
$gitbook serve
Starting server ...
Serving book on http://localhost:4000
Restart after change in file portus.md
访问http://localhost:4000就可以看到你写的东西!!!
5)提交上gitlab,执行以下几行命令
$git add .
$git commit -m "first commit"
$git push -u origin master
接着确认开启共享Runner,在GitLab上打开工程的Settings->Runners页面:
![](https://img.haomeiwen.com/i2106114/774f4b652d2a9bce.jpg)
启用Runner后就会开始构建了,构建成功后然档默认会输出到:
http://doc.mail.netease.com/{user_name or group_name}/{project_name}/latest
Enjoy(^__^) ……
gitbook的相关命令行:
git status
gitbook serve
git add .
git commit -m "first commit"
$git push -u origin master