Mercurial > hg > sv-dependency-builds
diff src/capnproto-git-20161025/doc/push-site.sh @ 48:9530b331f8c1
Add Cap'n Proto source
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 25 Oct 2016 11:17:01 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/capnproto-git-20161025/doc/push-site.sh Tue Oct 25 11:17:01 2016 +0100 @@ -0,0 +1,56 @@ +#! /usr/bin/env bash + +set -eu +shopt -s extglob + +if grep 'localhost:4000' *.md _posts/*.md; then + echo "ERROR: Your content has links to localhost:4000!" >&2 + exit 1 +fi + +if [ "x$(git status --porcelain)" != "x" ]; then + echo -n "git repo has uncommited changes. Continue anyway? (y/N) " >&2 + read -n 1 YESNO + echo >&2 + if [ "x$YESNO" != xy ]; then + exit 1 + fi +fi + +case $(git rev-parse --abbrev-ref HEAD) in + master ) + echo "On master branch. Will generate to /next." + CONFIG=_config_next.yml + PREFIX=/next + LABEL="preview site" + ;; + + release-* ) + echo "On release branch. Will generate to /." + CONFIG=_config.yml + PREFIX= + LABEL="site" + ;; + + * ) + echo "Unrecognized branch." >&2 + exit 1 + ;; +esac + +echo "Regenerating site..." + +rm -rf _site _site.tar.gz + +jekyll build --safe --config $CONFIG + +echo -n "Push now? (y/N)" +read -n 1 YESNO +echo + +if [ "x$YESNO" == "xy" ]; then + echo "Pushing..." + tar cz --xform='s,_site/,,' _site/* | gce-ss ssh fe --command "cd /var/www/capnproto.org$PREFIX && tar xz" +else + echo "Push CANCELED" +fi