Tone.js/gulp/push_build.sh

52 lines
966 B
Bash
Raw Normal View History

2017-08-30 15:12:33 +00:00
#!/bin/bash
2017-08-30 13:45:22 +00:00
2017-08-30 14:10:26 +00:00
TMP_DIR=$(pwd)/tmp
2017-08-30 13:45:22 +00:00
mkdir $TMP_DIR
2017-08-30 15:27:55 +00:00
TONE_DIR=$(pwd)/..
2017-08-30 13:45:22 +00:00
BUILD_DIR=$TMP_DIR/build
# clone the build repo
2017-08-30 15:12:33 +00:00
if [ "$TRAVIS" = "true" ]; then
2017-08-30 13:45:22 +00:00
GITHUB_USER=${GH_TOKEN}@
fi
git clone https://${GITHUB_USER}github.com/Tonejs/build $BUILD_DIR > /dev/null 2>&1
2017-08-30 14:10:26 +00:00
cd $BUILD_DIR
2017-08-30 14:00:25 +00:00
git checkout gh-pages
2017-08-30 13:45:22 +00:00
# generate a new build
2017-08-30 16:24:14 +00:00
gulp build
2017-08-30 13:45:22 +00:00
2017-08-30 13:45:22 +00:00
# push to the appropriate location
2017-08-30 15:12:33 +00:00
if [ "$TRAVIS" = "true" ]; then
2017-08-30 15:33:40 +00:00
2017-08-30 15:37:24 +00:00
2017-08-30 15:23:11 +00:00
if [ "$TRAVIS_BRANCH" = "dev" ]; then
2017-08-30 13:45:22 +00:00
2017-08-30 15:41:11 +00:00
# dev builds go into the dev folder
cp -a $TONE_DIR/build/. $BUILD_DIR/dev/
2017-08-30 13:45:22 +00:00
2017-08-30 15:12:33 +00:00
elif [ "$TRAVIS_BRANCH" = "master" ]; then
2017-08-30 13:45:22 +00:00
# master builds are on the root level folder
2017-08-30 15:47:12 +00:00
cp -a $TONE_DIR/build/. $BUILD_DIR/
2017-08-30 13:45:22 +00:00
# and also in a folder with the version name
VERSION=$(node $TONE_DIR/gulp/version.js $TONE_DIR)
mkdir $BUILD_DIR/$VERSION
cp -a $TONE_DIR/build/. $BUILD_DIR/$VERSION
2017-08-30 13:45:22 +00:00
fi
2017-08-30 15:33:40 +00:00
2017-08-30 13:45:22 +00:00
fi
# push the build
git add .
2017-08-30 15:50:26 +00:00
git commit -m "build #$TRAVIS_BUILD_NUMBER: $TRAVIS_COMMIT_MESSAGE"
2017-08-30 13:45:22 +00:00
git push -f
2017-08-30 14:10:26 +00:00
rm -rf $TMP_DIR