]> jfr.im git - irc/freenode/web-7.0.git/blame - deploy/deploy.sh
i think we are ready
[irc/freenode/web-7.0.git] / deploy / deploy.sh
CommitLineData
e388932a
EK
1#!/bin/sh
2
3if [ ! -f deploy/key1 ]; then exit; fi
4if [ -z "$TRAVIS_BRANCH" ]; then exit; fi
5
6BRANCH_DIR="$TRAVIS_BRANCH"
7
8if [ "$TRAVIS_PULL_REQUEST" != false ]; then
9 if [ "$TRAVIS_BRANCH" != master ]; then exit; fi
10
11 BRANCH_DIR="pull-$TRAVIS_PULL_REQUEST"
12fi
13
14export SSH_KEYFILE="$(readlink -f deploy/key1)"
15export GIT_SSH="$(readlink -f deploy/ssh.sh)"
16git clone -b gh-pages git@github.com:freenode/web-7.0.git .deploy || exit 1
17cd .deploy || exit 1
18git config user.name travis
19git config user.email travis@nowhere
20git rm -r "$BRANCH_DIR/*"
21mkdir -p "$BRANCH_DIR"
22cd "$BRANCH_DIR" || exit 1
23cp -r ../../out/* .
24git add -A
25git commit -m "travis: $TRAVIS_COMMIT"
26git push || exit 1
27cd ../..
28
29if [ "$TRAVIS_BRANCH" = master -a "$TRAVIS_PULL_REQUEST" = false ]; then
30 rm -rf .deploy
31 export SSH_KEYFILE="$(readlink -f deploy/key2)"
32 export GIT_SSH="$(readlink -f deploy/ssh.sh)"
33 git clone git@github.com:freenode/freenode.github.io.git .deploy || exit 1
34 cd .deploy || exit 1
35 git config user.name travis
36 git config user.email travis@nowhere
37 git ls-files -z | grep -vzZE '^(README.md|LICENSE|CNAME)$' | xargs -0 rm -f
38 cp -r ../out/* .
39 git add -A
40 git commit -m "travis: $TRAVIS_COMMIT"
41 git push || exit 1
42 cd ..
43fi