Tone.js/gulp/push_build.sh

47 lines
879 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
TONE_DIR=$(pwd)/../
BUILD_DIR=$TMP_DIR/build
2017-08-30 14:00:25 +00:00
echo tone dir: $TONE_DIR
echo build dir: $BUILD_DIR
2017-08-30 13:45:22 +00:00
# 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 15:23:11 +00:00
# gulp build
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:23:11 +00:00
if [ "$TRAVIS_BRANCH" = "dev" ]; then
2017-08-30 13:45:22 +00:00
# dev builds go into the dev folder
2017-08-30 15:12:33 +00:00
mkdir $BUILD_DIR/test/
2017-08-30 15:23:11 +00:00
cp $TONE_DIR/build/{Tone.js,Tone.min.js} $BUILD_DIR/test/
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:23:11 +00:00
cp $TONE_DIR/build/{Tone.js,Tone.min.js} $BUILD_DIR/
2017-08-30 13:45:22 +00:00
fi
fi
# push the build
git add .
git commit -m 'build ${TRAVIS_BUILD_NUMBER}'
git push -f
2017-08-30 14:10:26 +00:00
rm -rf $TMP_DIR