element/build/deploy-ci.sh

75 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-10-28 18:58:03 +08:00
# build dev site
2016-11-17 23:26:09 +08:00
if [ "$ROT_TOKEN" ]; then
2016-11-17 12:09:43 +08:00
npm run build:file && CI_ENV=/dev/$TRAVIS_BRANCH/ node_modules/.bin/cooking build -c build/cooking.demo.js
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/dev.git && cd dev
2016-11-17 12:09:43 +08:00
mkdir $TRAVIS_BRANCH
rm -rf $TRAVIS_BRANCH/**
cp -rf ../../examples/element-ui/** $TRAVIS_BRANCH/
2016-10-19 14:23:22 +08:00
git add -A .
2016-10-20 08:50:40 +08:00
git commit -m "$TRAVIS_COMMIT_MSG"
2016-10-19 14:23:22 +08:00
git push origin master
2016-10-28 18:09:07 +08:00
cd ../..
2016-10-28 17:06:36 +08:00
fi
2016-11-02 12:24:05 +08:00
# push theme-default
2016-11-17 23:26:09 +08:00
if [ "$ROT_TOKEN" ]; then
2016-11-02 12:24:05 +08:00
cd temp_web
2016-11-17 23:26:09 +08:00
git clone -b $TRAVIS_BRANCH https://$ROT_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default
2016-11-02 12:24:05 +08:00
rm -rf *
cp -rf ../../packages/theme-default/** .
git add -A .
git commit -m "$TRAVIS_COMMIT_MSG"
2016-11-17 12:09:43 +08:00
git push origin $TRAVIS_BRANCH
2016-11-02 12:24:05 +08:00
cd ../..
fi
2016-11-17 23:26:09 +08:00
if [ "$TRAVIS_TAG" ] && [ "$ROT_TOKEN" ]; then
2016-11-17 12:09:43 +08:00
# site sub folder
SUB_FOLDER=$(echo $TRAVIS_TAG | grep -o -E '^\d+\.\d+')
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-17 12:09:43 +08:00
# only remove files
mkdir $SUB_FOLDER
rm -f *
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 ../..
fi