Use this action to build your static website with Eleventy.
To use it, create a .github/workflows/eleventy_build.yml file which uses this repository as an action.
Here's an example which builds the site with this action, then deploys to GitHub Pages with peaceiris/actions-gh-pages:
name: Eleventy Build
on: [push]
jobs:
build_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
uses: cjerrington/actions-eleventy@v2
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: _site
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}This action accepts a couple of optional inputs:
| Input Name | Required? | Default | Description |
|---|---|---|---|
args |
No | "" |
Arguments to pass to the Eleventy invocation |
install_dependencies |
No | false |
If set to true, npm install will be run before Eleventy is invoked |
For example:
- name: Build
uses: cjerrington/actions-eleventy@v2
with:
args: '--output=_dist'
install_dependencies: truev2 replaces the Docker container action with a composite action that runs natively on the GitHub runner. This means faster execution (no Docker image build/pull) and simpler maintenance.
| Aspect | v1 (Docker) | v2 (Composite) |
|---|---|---|
| Runtime | Custom Docker container | Native on the runner |
| Dependencies | Eleventy pre-installed globally | Resolved via npx (cached by npm) |
args input |
Optional, no default | Optional, defaults to '' |
install_dependencies |
Must be true or unset |
Must be 'true' (string) or 'false' |
- Update the action reference from
@v1.xto@v2(or@master). - If you use
install_dependencies: true, change it toinstall_dependencies: 'true'(string, since composite action inputs are always strings). - Remove any workflow workarounds you may have added to handle the Docker container (e.g. custom
npm installsteps before the action — v2 handles this natively). - The
DEPLOY_TOKENsecret is no longer needed — use the built-inGITHUB_TOKENinstead (or keep your own if you prefer).
Before (v1):
- uses: actions/checkout@master
- name: Build
uses: cjerrington/actions-eleventy@v1.3
with:
install_dependencies: trueAfter (v2):
- uses: actions/checkout@v4
- name: Build
uses: cjerrington/actions-eleventy@v2
with:
install_dependencies: 'true'