comparison src/capnproto-git-20161025/doc/push-site.sh @ 133:1ac99bfc383d

Add Cap'n Proto source
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 25 Oct 2016 11:17:01 +0100
parents
children
comparison
equal deleted inserted replaced
132:42a73082be24 133:1ac99bfc383d
1 #! /usr/bin/env bash
2
3 set -eu
4 shopt -s extglob
5
6 if grep 'localhost:4000' *.md _posts/*.md; then
7 echo "ERROR: Your content has links to localhost:4000!" >&2
8 exit 1
9 fi
10
11 if [ "x$(git status --porcelain)" != "x" ]; then
12 echo -n "git repo has uncommited changes. Continue anyway? (y/N) " >&2
13 read -n 1 YESNO
14 echo >&2
15 if [ "x$YESNO" != xy ]; then
16 exit 1
17 fi
18 fi
19
20 case $(git rev-parse --abbrev-ref HEAD) in
21 master )
22 echo "On master branch. Will generate to /next."
23 CONFIG=_config_next.yml
24 PREFIX=/next
25 LABEL="preview site"
26 ;;
27
28 release-* )
29 echo "On release branch. Will generate to /."
30 CONFIG=_config.yml
31 PREFIX=
32 LABEL="site"
33 ;;
34
35 * )
36 echo "Unrecognized branch." >&2
37 exit 1
38 ;;
39 esac
40
41 echo "Regenerating site..."
42
43 rm -rf _site _site.tar.gz
44
45 jekyll build --safe --config $CONFIG
46
47 echo -n "Push now? (y/N)"
48 read -n 1 YESNO
49 echo
50
51 if [ "x$YESNO" == "xy" ]; then
52 echo "Pushing..."
53 tar cz --xform='s,_site/,,' _site/* | gce-ss ssh fe --command "cd /var/www/capnproto.org$PREFIX && tar xz"
54 else
55 echo "Push CANCELED"
56 fi