In setting up this new blog software hugo, I needed to scrape together a handful of shell scripts to make my workflow easier. The first one I slung together is newpost.sh
hugo new posts/"$1"
A very simple shim so I don’t have to remember the hugo command or the path to store new posts to. It takes an argument ($1) that is the markdown file for the new post I want to create. I can call it like so: “./newpost.sh bash-hugo.md”
Now that I have the basis of a new post, I can edit it in markdown until I’m happy, and then call blogpost.sh.
hugo -d ~/git/bakey.us/html/blog/
This deploys the hugo generated static content out to my git repo for bakey.us. Then it calls “postblog.sh” as you can see on line 2 there.
cd ~/git/bakey.us || exit
git add html/blog/* && git commit -am "new blog post" && git push
This last script is a simple set of git commands (run in the correct path on disk) that results in a push up to gitlab.com which has commit hooks that deploy my new code out to an nginx docker container.