Skip to content

Build 11ty (Eleventy) dockerless to be able to use i.e. eleventy-img pluging with gh-runners

License

Notifications You must be signed in to change notification settings

extrawitz/11ty-dockerless-build

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Eleventy (11ty)

This action fetches all dependencies via npm install which are specified in your .eleventy.js and builds then the website.

No docker is used. No root-permissions needed on your self-hosted runner

Features

  • this action runs flawless without root-permissions as docker is not used.
  • you can use most common plugins, i.e. @11ty/eleventy-img which ist not possible with docker-gh-actions.
  • You can pass custom args to the eleventy-command

Pre-Requisites

Example-Workflow

name: 11ty build
on: [push]
jobs:
  build_deploy:
   runs-on: self-hosted
   steps:
   - name: Checkout last commit of repository
	 uses: actions/checkout@v3
   - name: Install 11ty and build website
	 uses: extrawitz/11ty-dockerless-build@v1
   - name: Deploy
	 uses: peaceiris/actions-gh-pages@v3
	 with:
	  publish_dir: public
	  publish_branch: website
	  github_token: ${{ secrets.PSA }}

Use your custom args when building website with "eleventy"

To use your custom arguments, specify them in your workflow like in below example:

name: 11ty build
on: [push]
jobs:
  build_deploy:
   runs-on: self-hosted
   steps:
   - name: Checkout last commit of repository
	 uses: actions/checkout@v3
   - name: Install 11ty and build website
	 uses: extrawitz/11ty-dockerless-build@v1
	 with:
	  args: --formats=md,html,ejs
   - name: Deploy
	 uses: peaceiris/actions-gh-pages@v3
	 with:
	  publish_dir: public
	  publish_branch: website
	  github_token: ${{ secrets.PSA }}

See more details about this in eleventy-doc https://www.11ty.dev/docs/usage/

Pro-Tipp to keep your main-branch clean when working with Eleventy

You can exclude your public-folder from commits with adding a entry for the public folder into your .git/info/exclude file

Example

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

public/*

More Infos on that here https://git-scm.com/docs/gitignore#_description

PS @ Microsoft - branch specific .gitignores would be alltough nice :-)