Yesterday I covered the overview of how
this gets deployed.
Now for the detail.
The script for testing is more aspirational than functional. It runs a
spellcheck on the blog, but doesn’t die if it finds any.
I’m supposed to read the output. I never do. I should though. Someday
I’ll add consequences to the spellcheck run, but for now at least
Next up is the script that does the build and deployment to pages.
make publish BASEURL=http://kevin.pages.home/phrye.com/
mv output public
This is rather simple. It does the
make publish step but does a bit
to reset the base url. The resulting
output/ dir is moved to
publish/ to work with the gitlab pages system.
Note that this and the deploy job use a custom
container. The main change is that I’ve installed and built
hugo in it. There are some other tools and bits in there,
but for this project it’s hugo being there that matters.
The last step is a deploy which is done by getting credentials
from the Gitlab CI’s protected variables. Then it’s just
git push. The actual building of the blog is done via
a git hook on the server.
eval $(ssh-agent -s)
echo "$PRIVATE_KEY" > /ssh-id
chmod 600 /ssh-id
git push firstname.lastname@example.org:phrye.com.git HEAD:master
There are obvious improvements to be made. Ones that come to mind:
- The test step should fail on failures.
- Add a link checker to a scheduled build to check for
- Add a deploy checker to make sure the server side build job