element/build/deploy-ci.sh

79 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
2017-09-28 15:58:08 +08:00
# build theme-chalk
2016-11-07 18:13:12 +08:00
cd temp_web
2017-09-28 15:58:08 +08:00
git clone https://$ROT_TOKEN@github.com/ElementUI/theme-chalk.git && cd theme-chalk
2016-11-07 18:13:12 +08:00
rm -rf *
2017-09-28 15:58:08 +08:00
cp -rf ../../packages/theme-chalk/** .
2016-11-07 18:13:12 +08:00
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
git clone --depth 1 -b gh-pages --single-branch 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
2016-11-29 10:49:28 +08:00
2018-05-28 17:36:40 +08:00
SUB_FOLDER='2.4'
2016-11-17 12:09:43 +08:00
mkdir $SUB_FOLDER
2017-10-26 12:50:28 +08:00
rm -rf *.js *.css *.map static
2016-11-17 12:09:43 +08:00
rm -rf $SUB_FOLDER/**
2017-10-26 12:50:28 +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
2018-05-28 18:22:54 +08:00
npm run build:file && CI_ENV=/dev/$TRAVIS_BRANCH/ node_modules/.bin/cross-env NODE_ENV=production node_modules/.bin/webpack --config build/webpack.demo.js
2016-11-18 21:39:49 +08:00
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 ../..
2017-09-28 15:58:08 +08:00
# push dev theme-chalk
2016-11-18 21:39:49 +08:00
cd temp_web
2017-09-28 15:58:08 +08:00
git clone -b $TRAVIS_BRANCH https://$ROT_TOKEN@github.com/ElementUI/theme-chalk.git && cd theme-chalk
2016-11-18 21:39:49 +08:00
rm -rf *
2017-09-28 15:58:08 +08:00
cp -rf ../../packages/theme-chalk/** .
2016-11-18 21:39:49 +08:00
git add -A .
git commit -m "$TRAVIS_COMMIT_MSG"
git push origin $TRAVIS_BRANCH
cd ../..