From b470de0882f37277d3b4498000f4b86bc84b2569 Mon Sep 17 00:00:00 2001 From: khs1994 Date: Mon, 4 Sep 2017 12:47:22 +0800 Subject: [PATCH] add travis --- .travis.yml | 31 +++++++++++++++++++++++++++++++ .travis/deploy.sh | 29 +++++++++++++++++++++++++++++ .travis/khs1994-robot.enc | Bin 0 -> 1680 bytes 3 files changed, 60 insertions(+) create mode 100644 .travis.yml create mode 100755 .travis/deploy.sh create mode 100644 .travis/khs1994-robot.enc diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9d7a082 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +language: node_js +node_js: stable +cache: + directories: + - "node_modules" +before_install: +- openssl aes-256-cbc -K $encrypted_4514352cb17e_key -iv $encrypted_4514352cb17e_iv + -in .travis/khs1994-robot.enc -out ~/.ssh/id_rsa -d +- chmod 600 ~/.ssh/id_rsa +- git config --global user.name "khs1994-merge-robot" +- git config --global user.email "ai@khs1994.com" +- echo "TZ='Asia/Shanghai'; export TZ" >> ~/.profile +- . ~/.profile +install: +- git ls-files | while read file; do touch -d $(git log -1 --format="@%ct" "$file") "$file"; done +- npm install gitbook -g +- npm install -g gitbook-cli +script: +- gitbook install +- gitbook build +after_success: + - sh .travis/deploy.sh +branches: + only: + - master +env: + global: + - REPO: git@github.com:khs1994-gitbook/docker_practice.git +addons: + ssh_known_hosts: + - github.com diff --git a/.travis/deploy.sh b/.travis/deploy.sh new file mode 100755 index 0000000..0785733 --- /dev/null +++ b/.travis/deploy.sh @@ -0,0 +1,29 @@ +#!/bin/bash +git clone -b gh-pages "$REPO" .deploy_git +- git ls-files | while read file; do touch -d $(git log -1 --format="@%ct" "$file") "$file"; done +if [ ! $? = 0 ];then + #不存在 + echo -e "\033[31mINFO\033[0m BRANCH NOT exist" + mkdir .deploy_git + cd .deploy_git + git init + git remote add origin $REPO + git checkout -b gh-pages + cd .. +else + #存在 + echo -e "\033[32mINFO\033[0m BRANCH exist" + rm -rf .deploy_git/* +fi +# Deploy to GitHub and aliyun +cp -r _book/* .deploy_git/ +cd .deploy_git +git add . +COMMIT=`date "+%F %T"` +TAG=`date '+%s'` +git commit -m "Travis CI Site updated: $COMMIT" +git push -f origin gh-pages +git tag | tail -10 +git tag +git tag $TAG +git push origin $TAG diff --git a/.travis/khs1994-robot.enc b/.travis/khs1994-robot.enc new file mode 100644 index 0000000000000000000000000000000000000000..f46f6c7e354a4d41fd7987a2500e6da22a2669b4 GIT binary patch literal 1680 zcmV;B25pb`-o`nIpy8*pq!+AC0$or1y^NXxk`*8Cwd{!saky;JBfjw* z`7WNScM14F!WX|BWNs?Of_p>hdH9ROy=jU_XwwEoOUT>I_GuL;ZfNw4Y9NpEejMt2Xe!mpE@$l!7?w zDbW$2?y^`S8rXamDq{$9`c&W@FZag9>~G<>Iq7cb=O^Qk*5U*`jxDwqU>=4ht#nte z=Kj4*r^fMN{1Q}LoPiTqmh9O1rk}9*y(sxd;pwEDwFs9)LsxntE&8f$*;F!MJ1=r` zDVh|2ZBA815&n9+3z(G)f|mYobC8-Q;N(rwa#V2un@{Fyv$g*$LIZtERPDBai`SQ* zEWOI;w}(Mtu;O4!9(X3|x_S;ACy>F8I?iUNA!KOx&`rL@2k%cOOFSx2kNyzVDDGO# zZ!E275ic_(*U;U7c31mCn`P6Vsg!2gX_;1Hzfy?uvRRH4yWM|R#_bt$AHL*}dd|NC zplqs+H$(oLn}e8sfk3%N(3{onjo4gFwqd9Zr)&o?Z#^_X3vQebjf z>({w9|uu=`X8v^#zZ^WFLg3a$o5wuXk1Kxv#_A-~Vo>sH`BPu)NIz7#0jd3I z^7y#aJ0r$cwu3^CHK^Hn-*_jZE`Rt|HMdNY_lWQleLsE0H+pkg4TQ`L?>EEVX>KiB zHx+f6=Y7V^F+35=eWXry$Z79f#%K_j5BzDbex9D-Lt}5^8&-?E8kX1pKw-KG$f3m| zl;(622w-Hug*HMogIR&ap00xAmA*qB5ppGiQ*MowdHE+=7Suk;y#u`g;p76~te4Gs z1;~bi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