deploy.sh (view raw)
1set -e
2# Forgetting uncomitted files in the working directory has costed me the draft of another blog post :)
3git status | grep "working tree clean" || (echo "ABORTING DEPLOY, WOULD LOSE FILES"; exit 1)
4zola build
5git checkout gh-pages
6# Forgetting to exclude `.git` has costed me several days worth of work and over 30 commits :)))
7find . -maxdepth 1 -not -name '.' -not -name '.git' -not -name 'public' -exec rm -r {} \;
8mv public/* .
9echo "birabittoh.dev" > CNAME
10rmdir public/
11git add .
12git commit -m "Deploy site"
13git push
14git checkout master