Browse Source

travis: auto build site

qingwei.li 8 years ago
parent
commit
96f4189efd
1 changed files with 18 additions and 4 deletions
  1. 18 4
      build/deploy-ci.sh

+ 18 - 4
build/deploy-ci.sh

@@ -1,12 +1,13 @@
 #! /bin/sh
 mkdir temp_web
+git config user.name "element_bot"
+git config user.email "element_bot"
 
+# build dev site
 if [ "$TRAVIS_BRANCH" = "master" ] && [ "$GH_TOKEN" ]; then
   CI_ENV=/dev/ ./node_modules/.bin/cooking build -c build/cooking.demo.js
   cd temp_web
   git clone https://$GH_TOKEN@github.com/ElementUI/dev.git && cd dev
-  git config user.name "$TRAVIS_COMMIT_USER"
-  git config user.email "$TRAVIS_COMMIT_EMAIL"
   rm -rf *
   cp -rf ../../examples/element-ui/** .
   git add -A .
@@ -15,12 +16,11 @@ if [ "$TRAVIS_BRANCH" = "master" ] && [ "$GH_TOKEN" ]; then
   cd ../..
 fi
 
+# build lib
 if [ "$TRAVIS_TAG" ] && [ "$GH_TOKEN" ]; then
   npm run dist
   cd temp_web
   git clone https://$GH_TOKEN@github.com/ElementUI/lib.git && cd lib
-  git config user.name "$TRAVIS_COMMIT_USER"
-  git config user.email "$TRAVIS_COMMIT_EMAIL"
   rm -rf *
   cp -rf ../../lib/** .
   git add -A .
@@ -29,3 +29,17 @@ if [ "$TRAVIS_TAG" ] && [ "$GH_TOKEN" ]; then
   git push origin master --tags
   cd ../..
 fi
+
+# build site
+if [ "$TRAVIS_TAG" ] && [ "$GH_TOKEN" ]; then
+  npm run deploy
+  cd temp_web
+  git clone https://$GH_TOKEN@github.com/ElemeFE/element.git && cd element
+  git checkout gh-pages
+  rm -rf *
+  cp -rf ../../examples/element-ui/** .
+  git add -A .
+  git commit -m "$TRAVIS_COMMIT_MSG"
+  git push origin gh-pages
+  cd ../..
+fi