element/build/deploy-ci.sh

81 lines
2.0 KiB
Bash
Raw Normal View History

2016-10-19 14:23:22 +08:00
#! /bin/sh
2016-10-28 18:09:07 +08:00
mkdir temp_web
2016-11-17 23:26:09 +08:00
git config --global user.name "element-bot"
git config --global user.email "wallement@gmail.com"
2016-10-19 14:23:22 +08:00
2016-11-28 17:25:47 +08:00
if [ "$ROT_TOKEN" = "" ]; then
2016-11-18 21:39:49 +08:00
echo "Bye~"
exit 0
2016-11-02 12:24:05 +08:00
fi
2016-11-18 21:39:49 +08:00
# release
2016-11-28 17:25:47 +08:00
if [ "$TRAVIS_TAG" ]; then
2016-11-07 18:13:12 +08:00
# build lib
2016-10-28 17:06:36 +08:00
npm run dist
2016-10-28 18:09:07 +08:00
cd temp_web
2016-11-17 23:26:09 +08:00
git clone https://$ROT_TOKEN@github.com/ElementUI/lib.git && cd lib
rm -rf `find * ! -name README.md`
2016-10-28 17:06:36 +08:00
cp -rf ../../lib/** .
git add -A .
git commit -m "[build] $TRAVIS_TAG"
git tag $TRAVIS_TAG
git push origin master --tags
2016-10-28 18:09:07 +08:00
cd ../..
2016-10-28 18:58:03 +08:00
2016-11-07 18:13:12 +08:00
# build theme-default
cd temp_web
2016-11-17 23:26:09 +08:00
git clone https://$ROT_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default
2016-11-07 18:13:12 +08:00
rm -rf *
cp -rf ../../packages/theme-default/** .
git add -A .
git commit -m "[build] $TRAVIS_TAG"
git tag $TRAVIS_TAG
git push origin master --tags
cd ../..
# build site
npm run deploy:build
2016-10-28 18:58:03 +08:00
cd temp_web
2016-11-17 23:26:09 +08:00
git clone -b gh-pages https://$ROT_TOKEN@github.com/ElemeFE/element.git && cd element
2016-11-29 10:49:28 +08:00
# build sub folder
2016-12-06 17:40:47 +08:00
echo $TRAVIS_TAG
export SUB_FOLDER=$(echo "$TRAVIS_TAG" | grep -o -E "\d+\.\d+")
echo $SUB_FOLDER
2016-11-29 10:49:28 +08:00
2016-12-06 17:40:47 +08:00
SUB_FOLDER='1.0'
2016-11-17 12:09:43 +08:00
mkdir $SUB_FOLDER
2016-11-18 21:39:49 +08:00
rm -rf *.js *.css *.map static
2016-11-17 12:09:43 +08:00
rm -rf $SUB_FOLDER/**
2016-10-28 18:58:03 +08:00
cp -rf ../../examples/element-ui/** .
2016-11-17 12:09:43 +08:00
cp -rf ../../examples/element-ui/** $SUB_FOLDER/
2016-10-28 18:58:03 +08:00
git add -A .
git commit -m "$TRAVIS_COMMIT_MSG"
git push origin gh-pages
cd ../..
2016-11-18 21:39:49 +08:00
echo "DONE, Bye~"
exit 0
2016-10-28 18:58:03 +08:00
fi
2016-11-18 21:39:49 +08:00
# 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 ../..