Automated Hugo deployments anywhere using Wercker

I have double quotes around version in wercker.yml:

build:
  steps:
    - arjen/hugo-build@1.4.0:
        version: "0.14"
        theme: lanyon
        flags: --buildDrafts=false

And no empty line between the last line of build and the deploy: line.

I don’t know if that causes that non-descriptive Wercker error, but perhaps it’s worth a try.

Thank you I will try editing the .yml file.

Edit: WOW! it worked! :slight_smile:

Thank you very much for your help @Jura

And on to the deploy error message = ) :
Should I create a gh-pages branch or is Wercker doing it on its own?

export WERCKER_STEP_ROOT="/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040"
export WERCKER_STEP_ID="gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040"
export WERCKER_STEP_OWNER="lukevivier"
export WERCKER_STEP_NAME="gh-pages"
export WERCKER_REPORT_NUMBERS_FILE="/report/gh-pages-c578859c-3d36-4d5b-8efa-   d3327a7de040/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/artifacts"
export WERCKER_GH_PAGES_TOKEN="$GIT_TOKEN"
export WERCKER_GH_PAGES_DOMAIN="www.castillosings.com"
export WERCKER_GH_PAGES_BASEDIR="public"
source "/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh" < /dev/null
using github repo "Darthen/CastilloSings"
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 49: git: command not found
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 51: git: command not found
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 52: git: command not found
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 54: git: command not found
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 55: git: command not found
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 56: git: command not found
/pipeline/gh-pages-c578859c-3d36-4d5b-8efa-d3327a7de040/run.sh: line 60: warning: command not found
failed: failed pushing to github pages

If I recall correctly, a gh-pages branch is needed.

Hi @JazzVocalistMe, did you manage to resolve the problem with the GitHub deploy script? I am having the same issue:

export WERCKER_STEP_ROOT="/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d"
export WERCKER_STEP_ID="gh-pages-a68f081a-fd26-4053-998a-25ae7288143d"
export WERCKER_STEP_OWNER="lukevivier"
export WERCKER_STEP_NAME="gh-pages"
export WERCKER_REPORT_NUMBERS_FILE="/report/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/artifacts"
export WERCKER_GH_PAGES_TOKEN="$GIT_TOKEN"
export WERCKER_GH_PAGES_BASEDIR="public"
source "/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh" < /dev/null
using github repo "mywebsite"
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 49: git: command not found
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 51: git: command not found
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 52: git: command not found
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 54: git: command not found
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 55: git: command not found
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 56: git: command not found
/pipeline/gh-pages-a68f081a-fd26-4053-998a-25ae7288143d/run.sh: line 60: warning: command not found
failed: failed pushing to github pages

Hi @tompollard,
I encountered same problem. But I resolved the problem by updating some settings.
My solution is below.

  1. Modify wercker.yml
    box: debian to box: wercker/default
  2. Change stacks from Docker to Classic at “Infrastructure stack” section in settings page.

Following github issue helped me.
[uetchy/wercker-step-gh-pages/issues/1][1]
[1]: https://github.com/uetchy/wercker-step-gh-pages/issues/1

1 Like

Hey there @ArjenSchwarz

Great tutorial, I followed it but I just have one problem, the gh-pages is deploying fine but the content is empty!
I don’t know why this is happening!
Is it because I don’t provide a CNAME or something like that? I followed the steps carefully!
the repo is the following: https://github.com/tiagonbotelho/myBlog

EDIT: fixed it it was the theme that was having conflicts all good now! thank you for your time!

@tiagonbotelho I’m glad that it worked out already

I fixed the same error in my build by adding a content directory to my hugo source repository:

mkdir content
touch content/.gitkeep

Interesting!

Does your build step support deploying the site to CDN or Azure BlogStorage?

@michaelsync this build step is really just for building the static site, which you can then use with any of the deployment steps Wercker offers. Unfortunately I’m not familiar enough with Azure to know if that is something that is supported out of the box. In general though, most general deployments method like (S)FTP or even git push have solutions that you can use. To see if it suits your particular use case is something that you’ll have to decide for yourself though :).

Sure. Thanks Arjen!

Hi,
I’m having trouble with my wercker.yml file. The contents are:

box: wercker/default
build:
steps:
- arjen/hugo-build@1.6.
version: "0.14"
theme: hugo-creative-theme
Deploy:
steps:
-lukevivier/gh-pages@0.2.1:
token: $GIT_TOKEN
domain: www.golifeandsoul.com
basedir: public
This is the build error message:
Failed step: setup environment - Error parsing your wercker.yml: yaml: line 23: mapping values are not allowed in this context.

Any ideas what I’m doing wrong?
Mark

Hi @marksouthee,

It looks like there are a couple of lines not quite correct in your yml file. Unfortunately yaml is a very strict format, so it’s easy to have something break in there. I’ve modified it to the below which should work, remember though that if you use the Docker version of Wercker (the default in new projects) you will need to use a different box like for example debian instead of wercker/default. Good luck with this.

box: wercker/default
build:
  steps:
    - arjen/hugo-build@1.6.1:
        version: "0.14"
        theme: huge-creative-theme
deploy:    
  steps:        
    - lukevivier/gh-pages@0.2.1:
        token: $GIT_TOKEN
        domain: www.golifeandsoul.com
        basedir: public

Thanks @ArjenSchwarz ,
The indentation got mangled when I copied it in, but your changes worked. Strangely the Wercker yaml checker kept throwing errors about debian.
Many thanks
Mark

Hi @ArjenSchwarz,
Sorry to trouble you again. I’m now not able to Deploy to my github pages repository. I changed the domain from www.golifeandsoul.com to marksou.github.io, and this still builds fine in Wercker. However The deployment always fails with a “No pipeline named Deploy” error. I have entered my Github token as generated via Github, but it always fails.

Hi @marksouthee,
No worries, I’m glad to help. It’s weird though, as it doesn’t look like you made any changes that should impact this. Taking a quick look at your repository I notice that you accidentally changed an extra line (theme became debiantheme in the line before the deploy step) when you updated the domain name. Maybe try changing that back and see what happens. If that doesn’t work, can you email me the log of the build and I’ll try having a look at that.

Hi @ArjenSchwarz,
Well spotted, I missed that!!
However it’s not made a difference to the deploy, which still fails. Where do I find the log files for the deploys? I’ve looked and cant spot one?

Hi @marksouthee, sorry, I don’t think there are any actual log files you can access so it would just be all the output you see when it fails which might not be much if it fails immediately.
I just went over your wercker.yml file again though, and I spotted another small error that might cause this. Can you add a space between the - and lukevivier in the deploy stop configuration? I put the file through an online yaml parser (http://www.yamllint.com) and that missing space made the output look very strange so it’s likely that Wercker doesn’t recognise it as an actual step which would explain the error message.

Hi @ArjenSchwarz,
Well at least the deploy fails with a bit more info! :slight_smile:

See below:

 export WERCKER_STEP_ROOT="/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf"
export WERCKER_STEP_ID="gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf"
export WERCKER_STEP_OWNER="lukevivier"
export WERCKER_STEP_NAME="gh-pages"
export WERCKER_REPORT_NUMBERS_FILE="/report/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/artifacts"
export WERCKER_GH_PAGES_TOKEN="$GIT_TOKEN"
export WERCKER_GH_PAGES_DOMAIN="marksou.github.io"
export WERCKER_GH_PAGES_BASEDIR="public"
source "/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh" < /dev/null
using github repo "marksou/hugo-mikea"
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 49: git: command not found
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 51: git: command not found
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 52: git: command not found
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 54: git: command not found
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 55: git: command not found
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 56: git: command not found
/pipeline/gh-pages-2ecfb7c5-95e0-4878-88db-dab9b558b1cf/run.sh: line 60: warning: command not found
failed: failed pushing to github pages