From 69fe31f06e24e38d7267d546be0a0ab077426754 Mon Sep 17 00:00:00 2001 From: Cassie Jones Date: Sat, 2 Nov 2019 03:20:43 -0400 Subject: [PATCH] Add publish script --- publish.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 publish.sh diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..299dc4d --- /dev/null +++ b/publish.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if output=$(git status --porcelain) && [ -n "$output" ]; then + echo "Working directory not clean. Stash or commit your changes." + exit 1 +fi + +dir=$(mktemp -d) +if ! eleventy --output=$dir; then + echo "Failed" + exit 1 +fi + +starting_branch=$(git symbolic-ref --short HEAD) +git checkout master +rm -rf docs/ +mv $dir docs/ +git add docs/ +git commit -m "Publish" +git checkout "$starting_branch" +echo "Committed. Run: git push $(git remote) master:master" -- 2.47.0