docs: remove GH pages repo as submodule, adjust publish.sh

Would need to bump zrepl main repo for every publish otherwise...
This commit is contained in:
Christian Schwarz 2017-08-09 21:40:16 +02:00
parent 44b77a8ef9
commit 9e9f464de7
4 changed files with 33 additions and 7 deletions

4
.gitmodules vendored
View File

@ -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

1
docs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
public

@ -1 +0,0 @@
Subproject commit 15268c37f79ca4105f13a0e5ca939ad5d9013ca8

View File

@ -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`"