Skip to content

Commit

Permalink
Fixed post build script
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Jan 11, 2013
1 parent fe38f61 commit ff9bdc2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions build/post_build.sh
Expand Up @@ -2,6 +2,13 @@ if [ "$TRAVIS_PULL_REQUEST" != "true" ]; then
export REPO="$(pwd | sed s,^/home/travis/builds/,,g)"
declare -a supported_branches=('master' 'v3.0') # List of branches to store build output for

#Set git user
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis"

#Set upstream remote
git remote add upstream https://${GH_TOKEN}@github.com/${REPO}.git > /dev/null

#Copy result of build and demo in a temporary location
cp -R dist $HOME/dist
cp -R demos $HOME/demos
Expand All @@ -11,7 +18,7 @@ if [ "$TRAVIS_PULL_REQUEST" != "true" ]; then
if [ "$REPO" == "wet-boew/wet-boew" ]; then
#Update working example
if [ "$TRAVIS_BRANCH" == "master" ]; then
echo "Updating working examples..."
echo "Updating working examples...\n"

git add -f dist/.
git stash
Expand All @@ -21,14 +28,14 @@ if [ "$TRAVIS_PULL_REQUEST" != "true" ]; then
git stash pop
git add -f dist/.
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq https://${GH_TOKEN}@github.com/${REPO}.git gh-pages > /dev/null
git push -fq upstream gh-pages > /dev/null

echo "Finished updating the working examples"
echo "Finished updating the working examples\n"
fi

#Add the latest tags
case "${supported_branches[@]}" in *"$TRAVIS_BRANCH"*)
echo "Tagging the latest build for branch $TRAVIS_BRANCH"
echo "Tagging the latest build for branch $TRAVIS_BRANCH\n"

build_branch="$TRAVIS_BRANCH-dist"

Expand All @@ -42,9 +49,9 @@ if [ "$TRAVIS_PULL_REQUEST" != "true" ]; then
git add -f dist
git add -f demos
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to $TRAVIS_BRANCH"
git push -fq https://${GH_TOKEN}@github.com/${REPO}.git $build_branch > /dev/null
git push -fq upstream $build_branch > /dev/null

echo "Finished tagging the latest build for branch $TRAVIS_BRANCH"
echo "Finished tagging the latest build for branch $TRAVIS_BRANCH\n"
;; esac
fi
fi

0 comments on commit ff9bdc2

Please sign in to comment.