Skip to main content

Automated deployments of this site with Wercker

·2 mins

Update: I’m now using BitBucket Pipelines instead.

Since moving this site to S3, I have been using a post-commit hook to deploy it with s3cmd, which looks like this:


branch=$(git rev-parse --abbrev-ref HEAD)

if [[ "$branch" == "master" ]]; then
  echo "Syncing public/* with s3://$bucket."
  s3cmd --acl-public --no-delete-removed --no-progress --cf-invalidate --acl-public sync public/* s3://$bucket
  echo -e "\nUpdated s3://$bucket."

That worked OK, but it’s not great that it depends on my environment. I use two computers and want to be able to update this site from either of them, and I want to ensure they are built in exactly the same way with the same versions of Hugo and s3cmd.

So I looked around for a cloud hosted continuous delivery platform and eventually came across Wercker. It’s a Docker based service that is fully integrated with Bitbucket (where I host my repository), and has an impressive free plan.

Specifying the build steps is done using a simple yaml file, and by following this guide on the hugo website I got it up and running in no time, swapping the Git pages deploy step with this:

    - arjen/[email protected]:
        key-id: $KEY
        key-secret: $SECRET
        bucket-url: s3://
        source-dir: public
        delete-removed: false
        opts: --no-delete-removed --no-progress --cf-invalidate --acl-public

I’m very impressed with Wercker - it couldn’t have been easier to get this done. Look forward to using it for more of my personal projects.