Buddyworks

So I discovered Buddy.works recently … I wanted to automate the build and deployment of my website since I started using Hugo as automation means less chance of errors from having repeatable tasks which are done for you, not by you - giving you more time to write, read, exercise, whatever. When you first connect Github to Buddyworks it detects that you have Hugo and suggests what action to build.

buddyworks pipeline

This article is to save you time and identifies a few things you need to change.you need to change. I’ll show you to resolve first run errors:

  1. Add Git
  2. Out of date version of Hugo
  3. Invalid $working directory
  4. Test and resolve

I’m a fan of Continuous Integration and Continuous Deployment (CI/CD) , and previously used Jenkins; I had hoped to use Github Actions for Hugo, but I needed rsync because of my current hosting solution and Github Action for rsync was broken. Which is where Buddy.works fits in.

Buddy.works (and there will be other web apps in this category) allows you to create pipelines that do things - in my case, build Hugo and then deploy the site using rsync. You can also use it to automate testing, etc

Buddy.works out of the box Hugo action is broken

Buddy.works out of the box setup for Hugo has no git, uses a build command that points to a wrong working directory and running on a very old version of Hugo

When you first try to run your Deploy pipeline, it will error quickly …

buddyworks errors hugo
  • Failed to read Git log: Git executable not found in $PATH
  • Failed to unmarshal YAML: yaml: did not find expected key
1
2
3
4
5
hugo -c /buddy/<your project>
ERROR 2020/07/14 17:19:47 Failed to read Git log: Git executable not found in $PATH
Building sites ... Total in 381 ms
Error: Error building site: "/buddy/<your project>/archetypes/default.md:2:1": failed to unmarshal YAML: yaml: did not find expected key
Action failed: see logs above for details

Corrections in Buddy.work Actions

There are 3 corrections to make …

  1. Add Git to Environment
  2. Update the Hugo build command
  3. Update the Hugo version

So go ahead and edit the Hugo action …

Run - Update the Hugo build command

The existing command points to an invalid $WORKING_DIR which we don’t need as all the content is in Git

So go ahead and change it to what you prefer … I like hugo --cleanDestinationDir --minify

Environment - Add Git and Latest Hugo and Extended

Click on Environment. Below is the standard text code … with no Git and a very old Hugo

1
2
3
4
5
6
apt-get update && apt-get install -y wget
#wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_0.54.0_Linux-64bit.deb
#extended
wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_extended_0.73.0_Linux-64bit.deb
dpkg -i hugo.deb
rm hugo.deb

Go ahead and change this to add in Git and a fresh Hugo:

1
2
3
4
5
6
7
apt-get update && apt-get -y install git
apt-get update && apt-get install -y wget
#wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_0.54.0_Linux-64bit.deb
#extended
wget -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.73.0/hugo_extended_0.73.0_Linux-64bit.deb
dpkg -i hugo.deb
rm hugo.deb

Note: remember to check if you are using Hugo-extended (hint if you use SCSS then use Hugo Extended)

Test and Go …

So now …

  1. Save the project
  2. Run it again
  3. enjoy some down time for a moment
  4. then add in your deploy action (rsync or whatever)

If you find a problem

  • check all your code is in Git
Tags: Deployment, Development, Continuous Intergration

Contact me today to find out how I can help you.

Meet the author

Photo for Damien Saunders
Damien Saunders
An experienced management consultant and business leader interested in digital transformation, product centred design and scaled agile. If I'm not writing about living with UCTD (an autoimmune disease), I'm probably listening to music, reading a book or learning more about wine.
Find our more about me.