Hugo and Bitrise

I’ve been playing with Hugo, a static website generator. I have never particularly enjoyed creating websites in HTML, and never found a builder that didn’t quickly annoy. Hugo appeals to my need for separation whilst offering a lovely geeky feel to website and blog creation.

I’m currently in love with Bitrise. It seems to require more tinkering than buddybuild but offers more power and flexibility. It also supports Xamarin projects, which buddybuild doesn’t.

Bitrise is designed to build iOS and Android apps. However it’s ability to modify and define your own workflows allows you to build other kinds of projects (if you don’t mind a little scripting). I’ve setup a Bitrise project which detects a push to my website git repo, builds the Hugo website and then uploads to my web server.

The Bitrise workflow editor generates a YAML file. Here’s the one which builds and deploys

format_version: 1.3.1
- push_branch: "*"
  workflow: primary
- pull_request_source_branch: "*"
  workflow: primary
    - activate-ssh-key@3.1.1:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@3.4.1: {}
    - script@1.1.3:
        title: Build site and upload
        - content: |-
            # fail if any commands fails
            set -e
            # debug log
            set -x

            brew install hugo


            cd public

            scp -r * matt@myserverip:/var/www/
        - is_debug: 'yes'
        - working_dir: "$BITRISE_SOURCE_DIR"

Simple to setup and seems to work great. I want to expand it eventually to build draft blog posts to a staging area so I can preview before going live. Hugo + Bitrise are a great solution for in 2017.