diff --git a/build/deploy-ci.sh b/build/deploy-ci.sh index 5ec7bd00c..8c2311504 100644 --- a/build/deploy-ci.sh +++ b/build/deploy-ci.sh @@ -3,35 +3,15 @@ mkdir temp_web git config --global user.name "element-bot" git config --global user.email "wallement@gmail.com" -# build dev site -if [ "$ROT_TOKEN" ]; then - npm run build:file && CI_ENV=/dev/$TRAVIS_BRANCH/ node_modules/.bin/cooking build -c build/cooking.demo.js - cd temp_web - git clone https://$ROT_TOKEN@github.com/ElementUI/dev.git && cd dev - mkdir $TRAVIS_BRANCH - rm -rf $TRAVIS_BRANCH/** - cp -rf ../../examples/element-ui/** $TRAVIS_BRANCH/ - git add -A . - git commit -m "$TRAVIS_COMMIT_MSG" - git push origin master - cd ../.. +if [[ "$ROT_TOKEN" = "" ]]; then + echo "Bye~" + exit 0 fi -# push theme-default -if [ "$ROT_TOKEN" ]; then - cd temp_web - git clone -b $TRAVIS_BRANCH https://$ROT_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default - rm -rf * - cp -rf ../../packages/theme-default/** . - git add -A . - git commit -m "$TRAVIS_COMMIT_MSG" - git push origin $TRAVIS_BRANCH - cd ../.. -fi - -if [ "$TRAVIS_TAG" ] && [ "$ROT_TOKEN" ]; then - # site sub folder - SUB_FOLDER=$(echo $TRAVIS_TAG | grep -o -E '^\d+\.\d+') +# release +if [[ "$TRAVIS_TAG" ]]; then + # build sub folder + SUB_FOLDER=$(echo $TRAVIS_TAG | grep -o -E '\d+\.\d+') # build lib npm run dist @@ -60,10 +40,8 @@ if [ "$TRAVIS_TAG" ] && [ "$ROT_TOKEN" ]; then npm run deploy:build cd temp_web git clone -b gh-pages https://$ROT_TOKEN@github.com/ElemeFE/element.git && cd element - - # only remove files mkdir $SUB_FOLDER - rm -f * + rm -rf *.js *.css *.map static rm -rf $SUB_FOLDER/** cp -rf ../../examples/element-ui/** . cp -rf ../../examples/element-ui/** $SUB_FOLDER/ @@ -71,4 +49,29 @@ if [ "$TRAVIS_TAG" ] && [ "$ROT_TOKEN" ]; then git commit -m "$TRAVIS_COMMIT_MSG" git push origin gh-pages cd ../.. + + echo "DONE, Bye~" + exit 0 fi + +# build dev site +npm run build:file && CI_ENV=/dev/$TRAVIS_BRANCH/ node_modules/.bin/cooking build -c build/cooking.demo.js +cd temp_web +git clone https://$ROT_TOKEN@github.com/ElementUI/dev.git && cd dev +mkdir $TRAVIS_BRANCH +rm -rf $TRAVIS_BRANCH/** +cp -rf ../../examples/element-ui/** $TRAVIS_BRANCH/ +git add -A . +git commit -m "$TRAVIS_COMMIT_MSG" +git push origin master +cd ../.. + +# push dev theme-default +cd temp_web +git clone -b $TRAVIS_BRANCH https://$ROT_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default +rm -rf * +cp -rf ../../packages/theme-default/** . +git add -A . +git commit -m "$TRAVIS_COMMIT_MSG" +git push origin $TRAVIS_BRANCH +cd ../..