Continuous Deployment of my static site with Hugo, Gogs and Drone CI
In the past I ran hugo locally to create the html files for chaosbunker.com and then used rsync
to publish them. Since I post so rarely, I never bothered automating this.
Yesterday, though, I remembered my plan to self-host Drone CI and configure it for my gogs git server, so that changes that are pushed to my hugo repository are immediately deployed.
After looking at Drone CI today I realised that setting this up isn’t actually that much work, so I decided to take care of it right away. Also, I liked the idea of adding Drone CI to dockerbunker (a tool I made to easily set up, backup and destroy dockerized services behind a reverse proxy).
I already am running gogs via dockerbunker, so all I needed to do is add Drone CI to dockerbunker, spin up my Drone CI server and fork the drone-hugo plugin to get a more recent version of hugo into my pipeline.
After logging into the Drone web UI and activating the repo that holds my hugo site, as well as adding .drone.yml
to the repository the entire process from pushing changes to seeing them published now takes around 10 seconds 😮 Neat:-)
This is the .drone.yml
I am using:
pipeline:
build:
image: chaosbunker/drone-hugo:latest
settings:
hugo_version: 0.55.5
url: https://chaosbunker.com
validate: true
volumes:
- /path/to/dockerbunker/data/web/chaosbunker.com:/drone/src/public
commands:
- hugo -v
Update: I am not using Hugo for my blog anymore. This blog is powered by Ghost.