From 9be61226ae33fc0c99444b4693dcecc3f6c312fe Mon Sep 17 00:00:00 2001 From: Hazel Snider Date: Tue, 8 Sep 2020 22:36:52 -0400 Subject: [PATCH] Deploy script --- .gitignore | 2 +- deploy.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 deploy.sh diff --git a/.gitignore b/.gitignore index 3b387d3..becd937 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ public/ -deploy/ +.deploy/ diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..c5b142a --- /dev/null +++ b/deploy.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if [ "`git status -s`" ] +then + echo "The working directory is dirty. Please commit any pending changes." + exit 1; +fi + +echo "Deleting old publication" +rm -rf .deploy +mkdir .deploy +git worktree prune +rm -rf .git/worktrees/-deploy/ + +echo "Checking out gh-pages branch into public" +git worktree add -B gh-pages .deploy origin/gh-pages + +echo "Generating site" +zola build +cp -r public/* .deploy/ + +echo "Updating gh-pages branch" +cd .deploy && git add --all && git commit -m "Publishing to gh-pages (deploy.sh)" + +echo "Pushing to github" +git push --all