Build Eleventy Using Github Actions and Github Pages
I have been helping a friend move his not-so-static php based websites to a static site setup served by GitHub Pages. Perfect opportunity to play around with eleventy and github actions (mostly because I have never liked Jekyll)
The idea is to use a Github Action to build static pages using eleventy and push them to the
gh-pages branch. The action below does exactly that.
It uses the nodejs action to run the build script. The other important thing is to move all the eleventy config to
.eleventy.js. Since the build will be run via npm, it makes sense to add a build script to
build line looks like
"build": "eleventy --formats=md,html". I could move the
--formats part to eleventy config, but the eleventy docs is a little confusing (plus this works, so no motivation).
Anyway, here is the workflow file I use. It is also available as a gist