X-Git-Url: https://jfr.im/git/irc/freenode/web-7.0.git/blobdiff_plain/0fbb96f6f653258882d5268fe91ba4ae4a9e0a0a..refs/pull/99/head:/deploy.sh diff --git a/deploy.sh b/deploy.sh index e73b0e431..141009224 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,17 +1,26 @@ #!/bin/sh +if [ ! -f .deploy-key ]; then exit; fi if [ -z "$TRAVIS_BRANCH" ]; then exit; fi -if [ ! "$TRAVIS_BRANCH" = master ]; then exit; fi + +BRANCH_DIR="$TRAVIS_BRANCH" + +if [ "$TRAVIS_PULL_REQUEST" != false ]; then + if [ "$TRAVIS_BRANCH" != master ]; then exit; fi + + BRANCH_DIR="pull-$TRAVIS_PULL_REQUEST" +fi export SSH_KEYFILE="$(readlink -f .deploy-key)" export GIT_SSH="$(readlink -f ssh.sh)" -git clone -b gh-pages git@github.com:freenode/web-7.0.git .deploy -cd .deploy +git clone -b gh-pages git@github.com:freenode/web-7.0.git .deploy || exit 1 +cd .deploy || exit 1 git config user.name travis git config user.email travis@nowhere -rm -rf * -cp -r ../out/* . -cp -r ../static . +git rm -r "$BRANCH_DIR/*" +mkdir -p "$BRANCH_DIR" +cd "$BRANCH_DIR" || exit 1 +cp -r ../../out/* . git add -A git commit -m "travis: $TRAVIS_COMMIT" -git push +git push || exit 1