Skip to content

Commit 0668ba2

Browse files
committed
independent 2.19.03.doc branch、adjust travis.yml deploy.sh
1 parent b606061 commit 0668ba2

File tree

4 files changed

+186
-3
lines changed

4 files changed

+186
-3
lines changed

.travis.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
dist: trusty
2+
env:
3+
global:
4+
- GH_REF: github.com/actiontech/dble-docs-cn
5+
- GH_USER: actiontech-bot
6+
- GH_MAIL: github@actionsky.com
7+
8+
# 指定环境语言
9+
language: node_js
10+
# 指定sudo权限
11+
sudo: required
12+
# 指定node版本
13+
node_js: v14.2.0
14+
# 指定缓存模块,缓存可以加速编译
15+
cache:
16+
directories:
17+
- node_modules
18+
19+
# 邮件通知
20+
notifications:
21+
email:
22+
recipients:
23+
- yanhuqing@actionsky.com
24+
on_success: never # default: change
25+
on_failure: always # default: always
26+
27+
# 构建的分支
28+
branches:
29+
only:
30+
- master
31+
- develop
32+
- /^[0-9]{1}.[0-9]{2}.[0-9]{2}.doc$/ #eg: 2.20.04.doc
33+
# 调整时区
34+
before_install:
35+
- export TZ='Asia/Shanghai'
36+
- sudo apt-get install -y calibre fonts-arphic-gbsn00lp
37+
38+
# 安装环境
39+
install:
40+
- npm install -g gitbook-cli
41+
- npm install gitbook-plugin-yahei
42+
- gitbook install
43+
# gitbook生成静态文件
44+
script:
45+
- gitbook build
46+
deploy:
47+
# deploy develop to the staging environment
48+
- provider: script
49+
skip_cleanup: true
50+
script: bash ./deploy.sh develop 1 ${GH_TOKEN} $TRAVIS_BUILD_NUMBER
51+
on:
52+
branch: develop
53+
# deploy master to production
54+
- provider: script
55+
skip_cleanup: true
56+
script: bash ./deploy.sh master 1 ${GH_TOKEN} $TRAVIS_BUILD_NUMBER
57+
on:
58+
branch: master
59+
#branch eg: 2.20.04.doc
60+
- provider: script
61+
skip_cleanup: true
62+
script: bash ./deploy.sh $TRAVIS_BRANCH 1 ${GH_TOKEN} $TRAVIS_BUILD_NUMBER
63+
on:
64+
all_branches: true
65+
condition: $TRAVIS_BRANCH =~ ^[0-9]{1}.[0-9]{2}.[0-9]{2}.doc$

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
## 注意
22-
本分支上的手册适用于2.19.03.0版dble,其他版本的文档请参考对应tag分支或者release版文档。
22+
本分支上的手册适用于2.19.03.x版dble,其他版本的文档请参考对应tag分支或者release版文档。
2323

2424
## 提示
2525
[如果您使用了dble,请告诉我们。](https://wj.qq.com/s/2291106/09f4)

book.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
{
2-
"plugins": ["expandable-chapters"],
2+
"plugins": ["expandable-chapters", "splitter", "back-to-top-button","github","popup","versions-select"],
33
"pluginsConfig": {
44
"fontsettings": {
55
"theme": "sepia",
66
"family": "sans",
77
"size": 2
8-
}
8+
},
9+
"versions": {
10+
"gitbookConfigURL": "https://raw.githubusercontent.com/actiontech/dble-docs-cn/master/book.json"
11+
},
12+
"github":{
13+
"url":"https://github.com/actiontech/dble"
14+
},
15+
"plugins": [
16+
"yahei",
17+
"katex",
18+
"-search"
19+
]
920
},
1021
"styles": {
1122
"website": "website.css"

deploy.sh

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash
2+
set -e
3+
4+
VERSION="$1"
5+
DEPLOY="$2"
6+
GH_TOKEN="$3"
7+
TRAVIS_BUILD_NUMBER="$4"
8+
9+
10+
GH_REF="github.com/actiontech/dble-docs-cn"
11+
GH_USER="actiontech-bot"
12+
GH_MAIL="github@actionsky.com"
13+
14+
reg='^[0-9]{1}\.[0-9]{2}\.[0-9]{2}\.doc$' #eg: 2.20.04.doc
15+
if [ "$VERSION" = "master" ]; then
16+
# pdf
17+
# xvfb-run gitbook pdf ./ ./dble-manual.pdf
18+
mkdir -p _book/history/develop
19+
# merge history—pages
20+
mkdir _old_book
21+
cd ./_old_book
22+
COMMAND_LINE="git clone -b history-pages https://${GH_REF}.git"
23+
eval "$COMMAND_LINE"
24+
cd dble-docs-cn
25+
git archive history-pages | tar -x -C ../../_book/history/
26+
cd ../..
27+
# merge develop—pages
28+
mkdir _develop_book
29+
cd ./_develop_book
30+
COMMAND_LINE="git clone -b develop-pages https://${GH_REF}.git"
31+
eval "$COMMAND_LINE"
32+
cd dble-docs-cn
33+
git archive develop-pages | tar -x -C ../../_book/history/develop/
34+
#deploy
35+
if [ "$DEPLOY" = "1" ]; then
36+
cd ../../_book
37+
git init
38+
git config user.name "${GH_USER}"
39+
git config user.email "${GH_MAIL}"
40+
git add .
41+
git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER"
42+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" master:gh-pages
43+
fi
44+
45+
elif [ "$VERSION" = "develop" ]; then
46+
# merge master—pages
47+
mkdir _master_book
48+
cd ./_master_book
49+
COMMAND_LINE="git clone -b gh-pages https://${GH_REF}.git"
50+
eval "$COMMAND_LINE"
51+
rm -rf dble-docs-cn/history/develop/
52+
cd ..
53+
cp -R _book/ _master_book/dble-docs-cn/history/develop/
54+
#deploy to develop—pages
55+
if [ "$DEPLOY" = "1" ]; then
56+
# push gh-pages
57+
cd ./_master_book/dble-docs-cn
58+
git add .
59+
git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER"
60+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" gh-pages:gh-pages
61+
# push develop—pages
62+
cd ../../_book
63+
git init
64+
git config user.name "${GH_USER}"
65+
git config user.email "${GH_MAIL}"
66+
git add .
67+
git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER"
68+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" master:develop-pages
69+
fi
70+
elif [[ "$VERSION" =~ $reg ]]; then
71+
mkdir _old_book
72+
cd ./_old_book
73+
COMMAND_LINE="git clone -b history-pages https://${GH_REF}.git"
74+
eval "$COMMAND_LINE"
75+
rm -rf dble-docs-cn/$VERSION
76+
cd ..
77+
cp -R _book/ _old_book/dble-docs-cn/$VERSION
78+
cd _old_book/dble-docs-cn/$VERSION
79+
rm -rf .gitignore .travis.yml deploy.sh package-lock.json
80+
81+
cd ../../..
82+
mkdir _master_book
83+
cd ./_master_book
84+
COMMAND_LINE="git clone -b gh-pages https://${GH_REF}.git"
85+
eval "$COMMAND_LINE"
86+
rm -rf dble-docs-cn/history/$VERSION/
87+
cd ..
88+
cp -R _book/ _master_book/dble-docs-cn/history/$VERSION/
89+
cd _master_book/dble-docs-cn/history/$VERSION/
90+
rm -rf .gitignore .travis.yml deploy.sh package-lock.json
91+
cd ../../../..
92+
93+
## push
94+
if [ "$DEPLOY" = "1" ]; then
95+
cd ./_old_book/dble-docs-cn ##history-pages
96+
git add .
97+
git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER"
98+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" history-pages:history-pages
99+
cd ../../
100+
cd ./_master_book/dble-docs-cn ##gh-pages
101+
git add .
102+
git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER"
103+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" gh-pages:gh-pages
104+
fi
105+
else
106+
echo "do nothing"
107+
fi

0 commit comments

Comments
 (0)