I have my site almost done and it’s working great on the DEV URL. Currently, my workflow is:
- Write on my local machine
- run
hugo
- create zip of
public
directory - SFTP to webserver, unzip, etc…
I have a VPS I host other things on, and would like to host my site on the same server. I have my Hugo source checked into GitHub. Is there a way to automatically rebuild/refresh my site (on the VPS) on every commit to master (on GitHub)?
So far, my ideas are:
- Run
hugo
locally, push rendered HTML to separate repo. Use GitHub to trigger webhook to Caddy server (example here). - Run
hugo
locally, push rendered HTML to separate repo. Create cronjob on server to rungit pull
everyX
hours. - Run a webhook server on the VPS. Use GitHub to trigger webhook to run custom script that runs
git pull && hugo
on the server (example here).
So far, I think the third option is the best. I’d be open to any ideas. Thanks!