A couple of months ago I ported this blog from a custom PHP application to Jekyll. Back then I didn’t take the time to set up a deployment workflow. When I wrote the blogpost about Grunt yesterday, I was annoyed that I had open FileZilla to deploy the site. So today I wanted to set up an automated build/deployment system for this blog.
Since everything is hosted on Bitbucket, I needed to find a system that can run off a webhook and can run custom hooks / code in the build and deploy stages. Wercker is platform that does exactly that.
Next create a
wercker.yml file in the root of the web-directory
This is what the basic definition and build step of the wercker file look like.
bundle-install to install the dependencies and
jekyll doctor /
jekyll build to actually build the project.
This didn’t work for me initially becuase I didn’t have a
Gemfile in my repository.
Taking the Gemfile that is the default for github-pages seemed to do the trick.
source 'https://rubygems.org' require 'json' require 'open-uri' versions = JSON.parse(open('https://pages.github.com/versions.json').read) gem 'github-pages', versions['github-pages']
So now we can build the jekyll-project on wrecker, now all that’s needed is setting up deployment. Because I already have a simple ftp server set up where this project is already being hosted, I wanted to deploy to that environment. Most tutorials you find online for deploying with wercker use amazon s3 or aws for hosting. Setting up deployment for ftp is easy enough though. I added this in the wrecker.yml and set up $FTP_USERNAME and $FTP_PASS as environment variables in the wrecker dashboard.