How to Hakyll CircleCI 2.0

Posted on

This post documents my CircleCI configuration that builds Hakyll site and publishes it to GitHub pages.

It is inspired by configurations found on the Internet.


Use FPComplete docker image

Docker is the simplest executor type on CircleCI.

This configuration reuses FPComplete’s image with stack to avoid custom installation scripts.

Cache compiled dependencies

The job is going to recompile all dependencies on every build because it is using clean docker image.

It takes around 20 minutes to build template Hakyll blog. With caching configuration building time drops to less than a minute.

Generate content

Builds site application and uses it to generate static content

Push _site content to GitHub pages

Here master branch is not used for version control but rather as production environment so it makes more sense to keep it clean and wipe previous site content by git push --force