Easy Continuous Deployment of Hugo Sites

Wednesday, Mar 9, 2016

UPDATE: You can now continuously deploy your Hugo site using any CI tool and the new Aerobatic CLI. Check out this blog post for how to use Bitbucket Pipelines to deploy a Hugo site with Aerobatic.

We’re big fans of Hugo, the popular static site generator. That’s why we’re especially excited to let you know that Aerobatic now builds, deploys, and hosts Hugo sites.

Until now, if you wanted to host a Hugo site, you needed to do the build somewhere else - either on your local machine or by using a separate CI tool, and then push the built assets to your preferred hosting solution. Not anymore. Hugo is now a first class citizen on Bitbucket, just like Jekyll is on GitHub Pages. Less context switching. Less complexity. Faster deployments. And all the extra things you’ll need for your site like SSL, auth, custom errors, redirects, and more, all from within Bitbucket.

This blog post covers the high level, see the hugo docs for more in-depth information.

Enabling Automated Builds

To inform the Aerobatic build process to use Hugo, just declare the following snippet in your package.json manifest. You can, of course, use any Hugo theme of your choosing with the themeRepo option. Just tell Aerobatic where the theme’s git repo is.

{
  "_aerobatic": {
    "build": {
      "engine": "hugo",
      "themeRepo": "https://github.com/alexurquhart/hugo-geo.git"
    }
  }
}

The Aerobatic Deployment settings should specify the root directory / as the deployment target, not the public directory (that shouldn’t even be in the repo at all now).

In the Bitbucket add-on, you can view the Hugo log output for each build/deployment:

Hugo build log screenshot

Editing in Bitbucket

The great thing about this is that you can now just author posts directly in Bitbucket, make a commit, and Aerobatic will automatically deploy a new version of your Hugo site for you.

Hugo edit in Bitbucket screenshot

Summary

If you haven’t hosted your sites before with Bitbucket and Aerobatic, it’s easy to get started. We’ll have your site live in less than a minute. Once you’ve got your Hugo site on Aerobatic, you can then add more functionality, such as password protecting your site.

Here’s a link to the demo repo, just in case.

By the way, we also now automatically build Jekyll sites, and we’re quickly adding more static site generators. Feel free to let us know if you have a favorite you want us to support!