Permalink
Browse files

🔧 Try auto-deploy with CircleCI

  • Loading branch information...
june29 committed Jan 23, 2017
1 parent 13ccb8e commit 1d3bc5f1338a02e3dac8367db62ff7635fe9a937
Showing with 58 additions and 0 deletions.
  1. +21 −0 circle.yml
  2. +37 −0 scripts/push-to-gh-pages.sh
View
@@ -0,0 +1,21 @@
checkout:
post:
- git submodule sync
- git submodule update --init --recursive
machine:
timezone: Asia/Tokyo
dependencies:
pre:
- go get -v github.com/spf13/hugo
test:
override:
- "true"
deployment:
production:
branch: master
commands:
- ./scripts/push-to-gh-pages.sh
@@ -0,0 +1,37 @@
#!/bin/bash -eux
if [ -z "${GIT_USER_NAME}" ]; then
echo "Please set an env var GIT_USER_NAME"
exit 1
fi
if [ -z "${GIT_USER_EMAIL}" ]; then
echo "Please set an env var GIT_USER_EMAIL"
exit 1
fi
GIT_REPO="git@github.com:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git"
git submodule init
git submodule update
remote=`git ls-remote --heads 2> /dev/null | grep gh-pages || true`
if [ -n "$remote" ]; then
git clone -b gh-pages "${GIT_REPO}" public
rm -rf public/*
else
git init public
cd public
git checkout -b gh-pages
git remote add origin "${GIT_REPO}"
cd ..
fi
hugo
cd public
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"
git add --all
git commit -m '[ci skip]'
git push -f origin gh-pages

0 comments on commit 1d3bc5f

Please sign in to comment.