I have used WordPress, Grav and now Hugo throughout this blog. Unlike WordPress and Grav, Hugo is a static web page generator. You don’t need a server with PHP, Ruby, Python… Just download an executable on your computer and you’re done.
I will not comment on the operation, so if you want to know it in this link has the necessary.
Before we start we need to meet some requirements:
- Two repositories. One for Hugo and another for the generated content.
- A CD service. Like CircleCI or Travis. In this case I will use the first one.
In the root directory we will create three files:
push.sh and, in this case,
We will start by installing the necessary facilities. It’s just downloading Hugo’s executable and extracting it.
To use another version of Hugo you only have to change the variable
push on the Hugo repository, you have to update the other repository with the new content.
First you have to generate a token and add it to the CircleCI/Travis/etcétera environment variables. This way you can make a
push without having to write the password.
And finally the configuration for the CI/CD service.
For CircleCI this would be the necessary configuration. If another system is to be used, the idea would be the same:
- Install dependencies.
- Execute Hugo as if it was a test, because if an error occurs it would not continue.
- Publish the content generated in the other repository.