]> Witch of Git - web/blog/blob - publish.sh
Add eleventyImport annotations to fix build order
[web/blog] / publish.sh
1 #!/bin/bash
2
3 if output=$(git status --porcelain) && [ -n "$output" ]; then
4 echo "Working directory not clean. Stash or commit your changes."
5 exit 1
6 fi
7
8 dir=$(mktemp -d)
9 if ! eleventy --output=$dir; then
10 echo "Failed"
11 exit 1
12 fi
13
14 starting_branch=$(git symbolic-ref --short HEAD)
15 git checkout master
16 rm -rf docs/
17 mv $dir docs/
18 echo "blog.witchoflight.com" > docs/CNAME
19 git add docs/
20 git commit -m "Publish"
21 git checkout "$starting_branch"
22 echo "Committed. Run: git push $(git remote) master:master"