github + PR

项目使用github维护,主要通过PR进行维护。文档的Build和部署,由Organization成员负责。

项目放在https://github.com/BUAA-SCSE-Survival-Manual/BUAA-SCSE-Survival-Manual

1. install node.js

为了在本地编辑的时候,能够看到编辑后的效果,需要安装node.js

2. install gitbook-cli

npm install -g gitbook-cli

3. fork repo

3.1 fork repo

https://github.com/BUAA-SCSE-Survival-Manual/BUAA-SCSE-Survival-Manual

fork这个repo到自己的github账户,假如自己的repo名为: xxx

3.2 clone repo

clone仓库到本地

git clone xxx

4. edit & render

编辑后,查看效果

gitbook serve

实时编辑,实时渲染

Live reload server started on port: 35729
Press CTRL+C to quit ...

info: 7 plugins are installed
info: loading plugin "livereload"... OK
info: loading plugin "highlight"... OK
info: loading plugin "search"... OK
info: loading plugin "lunr"... OK
info: loading plugin "sharing"... OK
info: loading plugin "fontsettings"... OK
info: loading plugin "theme-default"... OK
info: found 26 pages
info: found 57 asset files
info: >> generation finished with success in 1.4s !

Starting server ...
Serving book on http://localhost:4000

然后就可以在浏览器中看到效果:

localhost4000

5. commit & create Pull Request

修改后,git add , git commit, git push 三部曲到自己的repo,会看到可以提交PR的提示

click_pr

  1. 点击,按照提示填写信息即可。
  2. PR在项目的Owner Reviewer过后,就会正常合入了。

6. Build 页面

  1. 目前Pages连接到的文件夹是main分支的docs, 所以如果想直接修改Pages页面的话,就需要

     gitbook build <文档所在的目录, 这里可以为当前目录 "." > docs
    

    然后正常推送PR就好了。Build之后会生成静态html/css/js资源到docs目录:

    builddocs

  2. 当然,直接加入这个organization 就可以方便地直接提交了。

results matching ""

    No results matching ""