capnproto

FORK: Cap'n Proto serialization/RPC system - core tools and C++ library
git clone https://git.neptards.moe/neptards/capnproto.git
Log | Files | Refs | README | LICENSE

push-site.sh (1136B)


      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     FUTURE=--future
     27     ;;
     28 
     29   release-* )
     30     echo "On release branch.  Will generate to /."
     31     CONFIG=_config.yml
     32     PREFIX=
     33     LABEL="site"
     34     FUTURE=
     35     ;;
     36 
     37   * )
     38     echo "Unrecognized branch." >&2
     39     exit 1
     40     ;;
     41 esac
     42 
     43 echo "Regenerating site..."
     44 
     45 rm -rf _site _site.tar.gz
     46 
     47 jekyll _3.8.1_ build --safe $FUTURE --config $CONFIG
     48 
     49 echo -n "Push now? (y/N)"
     50 read -n 1 YESNO
     51 echo
     52 
     53 if [ "x$YESNO" == "xy" ]; then
     54   echo "Pushing..."
     55   tar cz --xform='s,_site/,,' _site/* | gce-ss ssh alpha2 --command "cd /var/www/capnproto.org$PREFIX && tar xz"
     56 else
     57   echo "Push CANCELED"
     58 fi