Gitlab CI Hugo Deploy Failing

Posted March 25, 2018

Last updated February 23, 2019 | 2c29b4f


1 minute read

For a while, I had been having issues where GitLab-CI pipelines for this Hugo site would fail on the deploy function. This would let the site build correctly, but the files wouldn’t be pushed to the location where they were served to visitors. There are a few open issues where this same behavior is exhibited, but I did get a tip from @fyr77 on how they were able to resolve the issue for their own project.

I adapted this solution in my .gitlab-ci.yml file:

14
15
16
17
  script:
  - mkdir .public
  - hugo -d .public
  - mv .public public

What this does is:

  1. Make a directory called .public
  2. Build the Hugo site into the .public directory
  3. Rename the .public directory to public as it normally is built into

It appears the issue was somewhere with building all files into the public directory correctly, because after trying this out, builds all seem to work correctly now with no deploy fails.