]> jfr.im git - irc/freenode/web-7.0.git/commitdiff
deploy: build PRs
authorEd Kellett <redacted>
Sun, 28 Feb 2016 04:15:15 +0000 (04:15 +0000)
committerEd Kellett <redacted>
Sun, 28 Feb 2016 04:20:43 +0000 (04:20 +0000)
deploy.sh

index e35bdcf52abf6a75aa3a17a4cebddda13d1a415d..751752633c82b64ac68faf4608e3781238659490 100755 (executable)
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,8 +1,15 @@
 #!/bin/sh
 
+if [ ! -f .deploy-key ]; then exit; fi
 if [ -z "$TRAVIS_BRANCH" ]; then exit; fi
-if [ "$TRAVIS_BRANCH" != master ]; then exit; fi
-if [ "$TRAVIS_PULL_REQUEST" != false ]; 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)"
@@ -10,8 +17,10 @@ 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/* .
+mkdir -p "$BRANCH_DIR"
+cd "$BRANCH_DIR" || exit 1
+git rm '*'
+cp -r ../../out/* .
 git add -A
 git commit -m "travis: $TRAVIS_COMMIT"
 git push || exit 1