diff --git a/.gitmodules b/.gitmodules index ec6ce6f..deed4ea 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,4 @@ [submodule "docs/themes/docdock"] path = docs/themes/docdock url = git@github.com:zrepl/hugo-theme-docdock.git -[submodule "docs/public"] - path = docs/public - url = git@github.com:zrepl/zrepl.github.io.git + diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..a48cf0d --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +public diff --git a/docs/public b/docs/public deleted file mode 160000 index 15268c3..0000000 --- a/docs/public +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 15268c37f79ca4105f13a0e5ca939ad5d9013ca8 diff --git a/docs/publish.sh b/docs/publish.sh index 46369dc..1df3f15 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -2,24 +2,52 @@ set -eo pipefail GHPAGESREPO="git@github.com:zrepl/zrepl.github.io.git" +SCRIPTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +PUBLICDIR="${SCRIPTDIR}/public" + +checkout_repo_msg() { + echo "checkout ${GHPAGESREPO} to ${PUBLICDIR}:" + echo " git clone ${GHPAGESREPO} ${PUBLICDIR}" +} exit_msg() { echo "error, exiting..." } trap exit_msg EXIT +cd "$SCRIPTDIR" + +if [ ! -d "$PUBLICDIR" ]; then + checkout_repo_msg + exit 1 +fi + echo -n "PRESS ENTER to confirm you commited the docs changes to the zrepl repo" read -cd public +pushd "$PUBLICDIR" + echo "verify we're in the GitHub pages repo..." git remote get-url origin | grep -E "^${GHPAGESREPO}\$" +if [ "$?" -ne "0" ] ;then + checkout_repo_msg + exit 1 +fi + +echo "resetting GitHub pages repo to latest commit" +git fetch origin +git reset --hard origin/master + echo "cleaning GitHub pages repo" git clean -dn -cd .. + +popd + echo "building site" hugo -cd public + +pushd "$PUBLICDIR" + echo "adding and commiting all changes in GitHub pages repo" git add -A git commit -m "hugo render from publish.sh - `date -u`"