diff --git a/.travis.yml b/.travis.yml index bbbd57997e..567a4ff58e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,9 +28,11 @@ script: - ./tests/seahubtests.sh init && ./tests/seahubtests.sh runserver && ./tests/seahubtests.sh test after_success: - - .travis/rebuild-branches.sh - - ./tests/seahubtests.sh dist - - .travis/dist_and_push.sh + # notify seafile-docs to rebuild if current branch(6.3) is updated + - test $TRAVIS_PULL_REQUEST != "false" && test $TRAVIS_BRANCH = "6.3" && .travis/rebuild-branches.sh + + # making dist assets if current branch(master/6.3/6.2) is updated + - test $TRAVIS_PULL_REQUEST != "false" && .travis/dist_and_push.sh after_failure: true diff --git a/.travis/dist_and_push.sh b/.travis/dist_and_push.sh index 2fa1d65a01..349af6f497 100755 --- a/.travis/dist_and_push.sh +++ b/.travis/dist_and_push.sh @@ -1,20 +1,35 @@ -#!/bin/sh +#!/bin/bash +: ${PYTHON=python} -commit_media_files() { +set -e +if [[ ${TRAVIS} != "" ]]; then + set -x +fi + +set -x +SEAHUB_TESTSDIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))") +SEAHUB_SRCDIR=$(dirname "${SEAHUB_TESTSDIR}") + +export PYTHONPATH="/usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages:${SEAHUB_SRCDIR}/thirdpart:${PYTHONPATH}" +cd "$SEAHUB_SRCDIR" +set +x + +function commit_dist_files() { git checkout -b dist-$TRAVIS_BRANCH git add -u . && git add -A media/assets && git add -A static/scripts git commit -m "[dist] Travis build: #$TRAVIS_BUILD_NUMBER, based on commit $TRAVIS_COMMIT." -m "https://travis-ci.org/haiwen/seahub/builds/$TRAVIS_BUILD_ID" -m "$TRAVIS_COMMIT_MESSAGE" } -upload_files() { +function upload_files() { git push git@github.com:haiwen/seahub.git dist-$TRAVIS_BRANCH -f } -make_dist() { +function make_dist() { + echo "Making dist files ..." make dist } -# make_dist -commit_media_files +make_dist +commit_dist_files upload_files diff --git a/.travis/rebuild-branches.sh b/.travis/rebuild-branches.sh index 35524158ce..a585bdc636 100755 --- a/.travis/rebuild-branches.sh +++ b/.travis/rebuild-branches.sh @@ -1,10 +1,5 @@ #!/bin/sh -# seafile-docs branch rebuild is triggered only if the 6.3 branch status is successful -if [ $TRAVIS_BRANCH != "6.3" ]; then - exit -fi; - body='{ "request": { "branch":"seafile-docs"