set -e CVERSION=$(git tag | tail -1) echo "current version:$CVERSION" echo "Enter release version: " read VERSION read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r echo # (optional) move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then echo "Releasing $VERSION ..." # commit git add -A git commit -m "[build] $VERSION" npm version $VERSION --message "[release] $VERSION" # publish git push -u origin master git push npm publish fi
一、安裝gitbookgit
npm i -g gitbook-cli -d
二、docs目錄結構shell
. ├── book.json ├── README.md ├── SUMMARY.md ├── part1/ | ├── README.md | └── something.md └── part2/ ├── README.md └── something.md
三、特殊文件描述npm
文件 描述
book.json 配置數據 (optional)
README.md 電子書的前言或簡介 (required)
SUMMARY.md 電子書目錄 (optional)
GLOSSARY.md 詞彙/註釋術語列表 (optional)
四、SUMMARY.md文件內容json
# xx* [Introduction](README.md) * [Part I](part1/README.md) * [Writing is nice](part1/writing.md) * [GitBook is nice](part1/gitbook.md) * [Part II](part2/README.md) * [We love feedback](part2/feedback_please.md) * [Better tools for authors](part2/better_tools.md)
五、利用shell組合命令gitlab
cd docs rm -rf _book gitbook install gitbook build cd _book git init git add -A git commit -m 'update book' git push -f git@gitlab.com:xxx/xxxx.git master:gh-pages