From 1ee034e9f00f6412ac86c19f16032466f4538cff Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 29 Oct 2017 10:22:23 +0000 Subject: [PATCH] Add deploy script --- .circleci/deploy.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .circleci/deploy.sh diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh new file mode 100755 index 0000000..344c2f3 --- /dev/null +++ b/.circleci/deploy.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +if [ "${CIRCLE_BRANCH}" != "master" ]; then + echo "Only master branch can be deployed" + exit 0 +fi + +set -e + +DEPLOY_DIR=deploy + +git config --global push.default simple +git config --global user.email $(git --no-pager show -s --format='%ae' HEAD) +git config --global user.name $CIRCLE_USERNAME + +git clone -q --branch=gh-pages $CIRCLE_REPOSITORY_URL $DEPLOY_DIR + +cd $DEPLOY_DIR +rm -rf * +cp ../build/* . -r +git add -f . +git commit -m "Deploy build $CIRCLE_BUILD_NUM [ci skip]" || true +git push -fs