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:

bucket='andrew-jones.com'

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

if [[ "$branch" == "master" ]]; then
  hugo
  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."
fi

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:

deploy:
    steps:
    - arjen/[email protected]:
        key-id: $KEY
        key-secret: $SECRET
        bucket-url: s3://andrew-jones.com
        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.


Want great, practical advice on implementing data mesh, data products and data contracts?

In my weekly newsletter I share with you an original post and links to what's new and cool in the world of data mesh, data products, and data contracts.

I also include a little pun, because why not? 😅

(Don’t worry—I hate spam, too, and I’ll NEVER share your email address with anyone!)


Andrew Jones
Author
Andrew Jones
I build data platforms that reduce risk and drive revenue.