Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |