Skip to content

Commit

Permalink
The Travis post build is only for the main repo
Browse files Browse the repository at this point in the history
Skip it if it's PR testing or not the main repo
  • Loading branch information
nschonni committed Jan 21, 2013
1 parent 0c59e03 commit ec9af28
Showing 1 changed file with 55 additions and 57 deletions.
112 changes: 55 additions & 57 deletions build/post_build.sh
@@ -1,5 +1,5 @@
if [ "$TRAVIS_PULL_REQUEST" != "true" ]; then
export REPO="$(pwd | sed s,^/home/travis/build/,,g)"
export REPO="$(pwd | sed s,^/home/travis/build/,,g)"
if [ "$TRAVIS_PULL_REQUEST" != "true" ] && [ "$REPO" == "wet-boew/wet-boew" ]; then
declare -a supported_branches=('master' 'v3.0') # List of branches to store build output for

echo -e "Current repo: $TRAVIS_REPO_SLUG\n"
Expand All @@ -18,60 +18,58 @@ if [ "$TRAVIS_PULL_REQUEST" != "true" ]; then

git fetch upstream > /dev/null

if [ "$REPO" == "wet-boew/wet-boew" ]; then
#Update working example
if [ "$TRAVIS_BRANCH" == "master" ]; then
echo -e "Updating working examples...\n"

git add -f dist/.
git stash
git checkout gh-pages
git rebase --committer-date-is-author-date master
git rm -r dist/.
git stash pop
git add -f dist/.
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq upstream gh-pages > /dev/null

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

#Update the experimental working example
if [ "$TRAVIS_BRANCH" == "experimental" ]; then
echo -e "Updating experimental working examples...\n"

git add -f dist/.
git stash
git checkout gh-pages
git rebase --committer-date-is-author-date master
git rm -r dist/.
git stash pop
git add -f dist/.
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq experimental gh-pages > /dev/null

echo -e "Finished updating the experimental working examples\n"
fi

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

build_branch="$TRAVIS_BRANCH-dist"

git checkout -f "$build_branch"

#Replace the new dist and demo folders with the new ones
cp -Rf $HOME/dist .
cp -Rf $HOME/demos .

#Commit the result
git add -f dist
git add -f demos
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to $TRAVIS_BRANCH"
git push -fq upstream $build_branch > /dev/null

echo -e "Finished tagging the latest build for branch $TRAVIS_BRANCH\n"
;; esac
#Update working example
if [ "$TRAVIS_BRANCH" == "master" ]; then
echo -e "Updating working examples...\n"

git add -f dist/.
git stash
git checkout gh-pages
git rebase --committer-date-is-author-date master
git rm -r dist/.
git stash pop
git add -f dist/.
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq upstream gh-pages > /dev/null

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

#Update the experimental working example
if [ "$TRAVIS_BRANCH" == "experimental" ]; then
echo -e "Updating experimental working examples...\n"

git add -f dist/.
git stash
git checkout gh-pages
git rebase --committer-date-is-author-date master
git rm -r dist/.
git stash pop
git add -f dist/.
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq experimental gh-pages > /dev/null

echo -e "Finished updating the experimental working examples\n"
fi

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

build_branch="$TRAVIS_BRANCH-dist"

git checkout -f "$build_branch"

#Replace the new dist and demo folders with the new ones
cp -Rf $HOME/dist .
cp -Rf $HOME/demos .

#Commit the result
git add -f dist
git add -f demos
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to $TRAVIS_BRANCH"
git push -fq upstream $build_branch > /dev/null

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

0 comments on commit ec9af28

Please sign in to comment.