diff --git a/.travis.yml b/.travis.yml index 8db9cdba6..6a3c38d6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ branches: only: - master - develop + - /^[0-9]{1}.[0-9]{2}.[0-9]{2}.doc$/ #eg: 2.20.04.doc # 调整时区 before_install: - export TZ='Asia/Shanghai' @@ -55,3 +56,10 @@ deploy: script: bash ./deploy.sh master 1 ${GH_TOKEN} $TRAVIS_BUILD_NUMBER on: branch: master + #branch eg: 2.20.04.doc + - provider: script + skip_cleanup: true + script: bash ./deploy.sh $TRAVIS_BRANCH 1 ${GH_TOKEN} $TRAVIS_BUILD_NUMBER + on: + all_branches: true + condition: $TRAVIS_BRANCH =~ ^[0-9]{1}.[0-9]{2}.[0-9]{2}.doc$ diff --git a/README.md b/README.md index 873f5ca8f..e5ddfcd79 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # dble 中文技术参考手册 ## 注意 -本分支上的手册适用于3.22.07.0版dble,其他版本的文档请参考对应tag分支或者release版文档。 +本分支上的手册适用于3.22.07.x版dble,其他版本的文档请参考对应tag分支或者release版文档。 ## 目录 参考 [gitbook](https://actiontech.github.io/dble-docs-cn) 左侧目录区 或 [SUMMARY.md](https://github.com/actiontech/dble-docs-cn/blob/master/SUMMARY.md) diff --git a/book.json b/book.json index 38c516f93..f2f72dea0 100644 --- a/book.json +++ b/book.json @@ -11,59 +11,59 @@ "options": [ { "value": "https://actiontech.github.io/dble-docs-cn/", - "text": "Version 3.22.07.0" + "text": "Version 3.22.07" }, { "value": "https://actiontech.github.io/dble-docs-cn/history/develop/", "text": "Version develop" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/3.22.01.0/", - "text": "Version 3.22.01.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/3.22.01.doc/", + "text": "Version 3.22.01" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/3.21.10.0/", - "text": "Version 3.21.10.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/3.21.10.doc/", + "text": "Version 3.21.10" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/3.21.06.0/", - "text": "Version 3.21.06.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/3.21.06.doc/", + "text": "Version 3.21.06" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/3.21.02.0/", - "text": "Version 3.21.02.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/3.21.02.doc/", + "text": "Version 3.21.02" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/3.20.10.0/", - "text": "Version 3.20.10.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/3.20.10.doc/", + "text": "Version 3.20.10" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/3.20.07.0/", - "text": "Version 3.20.07.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/3.20.07.doc/", + "text": "Version 3.20.07" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/2.20.04.0/", - "text": "Version 2.20.04.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/2.20.04.doc/", + "text": "Version 2.20.04" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.11.0/", - "text": "Version 2.19.11.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.11.doc/", + "text": "Version 2.19.11" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.09.0/", - "text": "Version 2.19.09.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.09.doc/", + "text": "Version 2.19.09" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.07.0/", - "text": "Version 2.19.07.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.07.doc/", + "text": "Version 2.19.07" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.05.0/", - "text": "Version 2.19.05.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.05.doc/", + "text": "Version 2.19.05" }, { - "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.03.0/", - "text": "Version 2.19.03.0" + "value": "https://actiontech.github.io/dble-docs-cn/history/2.19.03.doc/", + "text": "Version 2.19.03" } ] }, diff --git a/deploy.sh b/deploy.sh index 58ea15bea..ddde063e2 100644 --- a/deploy.sh +++ b/deploy.sh @@ -11,6 +11,7 @@ GH_REF="github.com/actiontech/dble-docs-cn" GH_USER="actiontech-bot" GH_MAIL="github@actionsky.com" +reg='^[0-9]{1}\.[0-9]{2}\.[0-9]{2}\.doc$' #eg: 2.20.04.doc if [ "$VERSION" = "master" ]; then # pdf # xvfb-run gitbook pdf ./ ./dble-manual.pdf @@ -38,9 +39,9 @@ if [ "$VERSION" = "master" ]; then git config user.email "${GH_MAIL}" git add . git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER" - git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages + git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" master:gh-pages fi - + elif [ "$VERSION" = "develop" ]; then # merge master—pages mkdir _master_book @@ -56,7 +57,7 @@ elif [ "$VERSION" = "develop" ]; then cd ./_master_book/dble-docs-cn git add . git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER" - git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" gh-pages:gh-pages + git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" gh-pages:gh-pages # push develop—pages cd ../../_book git init @@ -64,8 +65,43 @@ elif [ "$VERSION" = "develop" ]; then git config user.email "${GH_MAIL}" git add . git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER" - git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:develop-pages + git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" master:develop-pages + fi +elif [[ "$VERSION" =~ $reg ]]; then + mkdir _old_book + cd ./_old_book + COMMAND_LINE="git clone -b history-pages https://${GH_REF}.git" + eval "$COMMAND_LINE" + rm -rf dble-docs-cn/$VERSION + cd .. + cp -R _book/ _old_book/dble-docs-cn/$VERSION + cd _old_book/dble-docs-cn/$VERSION + rm -rf .gitignore .travis.yml deploy.sh package-lock.json + + cd ../../.. + mkdir _master_book + cd ./_master_book + COMMAND_LINE="git clone -b gh-pages https://${GH_REF}.git" + eval "$COMMAND_LINE" + rm -rf dble-docs-cn/history/$VERSION/ + cd .. + cp -R _book/ _master_book/dble-docs-cn/history/$VERSION/ + cd _master_book/dble-docs-cn/history/$VERSION/ + rm -rf .gitignore .travis.yml deploy.sh package-lock.json + cd ../../../.. + + ## push + if [ "$DEPLOY" = "1" ]; then + cd ./_old_book/dble-docs-cn ##history-pages + git add . + git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER" + git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" history-pages:history-pages + cd ../../ + cd ./_master_book/dble-docs-cn ##gh-pages + git add . + git commit -m "Update GitBook By TravisCI With Build $TRAVIS_BUILD_NUMBER" + git push --force --quiet "https://${GH_TOKEN}@${GH_REF}.git" gh-pages:gh-pages fi -else +else echo "do nothing" fi