update release & deploy scripts

This commit is contained in:
Leopoldthecoder 2017-09-28 15:58:08 +08:00 committed by Black Wayne
parent b578670168
commit a0682ed983
4 changed files with 21 additions and 34 deletions

View File

@ -1,6 +1,6 @@
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var version = process.env.VERSION || require('../../package.json').version; var version = process.env.VERSION || require('../../package.json').version;
var content = { '1.0.9': '1.0', '1.1.6': '1.1', '1.2.9': '1.2', '1.3.7': '1.3' }; var content = { '1.0.9': '1.0', '1.1.6': '1.1', '1.2.9': '1.2', '1.3.7': '1.3', '1.4.6': '1.4' };
if (!content[version]) content[version] = '1.4'; if (!content[version]) content[version] = '2.0';
fs.writeFileSync(path.resolve(__dirname, '../../examples/versions.json'), JSON.stringify(content)); fs.writeFileSync(path.resolve(__dirname, '../../examples/versions.json'), JSON.stringify(content));

View File

@ -8,6 +8,9 @@ if [ "$ROT_TOKEN" = "" ]; then
exit 0 exit 0
fi fi
SUB_FOLDER=$(echo "2.0.0-alpha.1" | grep -o -E "\d+\.\d+")
echo $SUB_FOLDER
# release # release
if [ "$TRAVIS_TAG" ]; then if [ "$TRAVIS_TAG" ]; then
# build lib # build lib
@ -22,11 +25,11 @@ if [ "$TRAVIS_TAG" ]; then
git push origin master --tags git push origin master --tags
cd ../.. cd ../..
# build theme-default # build theme-chalk
cd temp_web cd temp_web
git clone https://$ROT_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default git clone https://$ROT_TOKEN@github.com/ElementUI/theme-chalk.git && cd theme-chalk
rm -rf * rm -rf *
cp -rf ../../packages/theme-default/** . cp -rf ../../packages/theme-chalk/** .
git add -A . git add -A .
git commit -m "[build] $TRAVIS_TAG" git commit -m "[build] $TRAVIS_TAG"
git tag $TRAVIS_TAG git tag $TRAVIS_TAG
@ -39,14 +42,14 @@ if [ "$TRAVIS_TAG" ]; then
git clone -b gh-pages https://$ROT_TOKEN@github.com/ElemeFE/element.git && cd element git clone -b gh-pages https://$ROT_TOKEN@github.com/ElemeFE/element.git && cd element
# build sub folder # build sub folder
echo $TRAVIS_TAG echo $TRAVIS_TAG
export SUB_FOLDER=$(echo "$TRAVIS_TAG" | grep -o -E "\d+\.\d+") SUB_FOLDER=$(echo "$TRAVIS_TAG" | grep -o -E "\d+\.\d+")
echo $SUB_FOLDER echo $SUB_FOLDER
SUB_FOLDER='1.4' SUB_FOLDER='2.0'
mkdir $SUB_FOLDER mkdir $SUB_FOLDER
rm -rf *.js *.css *.map static # rm -rf *.js *.css *.map static
rm -rf $SUB_FOLDER/** rm -rf $SUB_FOLDER/**
cp -rf ../../examples/element-ui/** . # cp -rf ../../examples/element-ui/** .
cp -rf ../../examples/element-ui/** $SUB_FOLDER/ cp -rf ../../examples/element-ui/** $SUB_FOLDER/
git add -A . git add -A .
git commit -m "$TRAVIS_COMMIT_MSG" git commit -m "$TRAVIS_COMMIT_MSG"
@ -69,11 +72,11 @@ git commit -m "$TRAVIS_COMMIT_MSG"
git push origin master git push origin master
cd ../.. cd ../..
# push dev theme-default # push dev theme-chalk
cd temp_web cd temp_web
git clone -b $TRAVIS_BRANCH https://$ROT_TOKEN@github.com/ElementUI/theme-default.git && cd theme-default git clone -b $TRAVIS_BRANCH https://$ROT_TOKEN@github.com/ElementUI/theme-chalk.git && cd theme-chalk
rm -rf * rm -rf *
cp -rf ../../packages/theme-default/** . cp -rf ../../packages/theme-chalk/** .
git add -A . git add -A .
git commit -m "$TRAVIS_COMMIT_MSG" git commit -m "$TRAVIS_COMMIT_MSG"
git push origin $TRAVIS_BRANCH git push origin $TRAVIS_BRANCH

View File

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
git checkout dev git checkout carbon
if test -n "$(git status --porcelain)"; then if test -n "$(git status --porcelain)"; then
echo 'Unclean working tree. Commit or stash changes first.' >&2; echo 'Unclean working tree. Commit or stash changes first.' >&2;

View File

@ -1,6 +1,3 @@
git checkout master
git merge dev
#!/usr/bin/env sh #!/usr/bin/env sh
set -e set -e
echo "Enter release version: " echo "Enter release version: "
@ -16,15 +13,10 @@ then
VERSION=$VERSION npm run dist VERSION=$VERSION npm run dist
# publish theme # publish theme
echo "Releasing theme-default $VERSION ..." echo "Releasing theme-chalk $VERSION ..."
cd packages/theme-default cd packages/theme-chalk
npm version $VERSION --message "[release] $VERSION" npm version $VERSION --message "[release] $VERSION"
if [[ $VERSION =~ "beta" ]] npm publish --tag next
then
npm publish --tag beta
else
npm publish
fi
cd ../.. cd ../..
# commit # commit
@ -33,16 +25,8 @@ then
npm version $VERSION --message "[release] $VERSION" npm version $VERSION --message "[release] $VERSION"
# publish # publish
git push eleme master git push eleme carbon
git push eleme refs/tags/v$VERSION git push eleme refs/tags/v$VERSION
git checkout dev
git rebase master
git push eleme dev
if [[ $VERSION =~ "beta" ]] npm publish --tag next
then
npm publish --tag beta
else
npm publish
fi
fi fi