├── Dockerfile ├── entrypoint.sh ├── action.yml ├── .github └── workflows │ └── test_build.yml └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:17-alpine 2 | RUN npm install -g @11ty/eleventy --unsafe-perm 3 | COPY entrypoint.sh / 4 | RUN chmod +x /entrypoint.sh 5 | ENTRYPOINT ["/entrypoint.sh"] 6 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$INPUT_INSTALL_DEPENDENCIES" = "true" ]; then 4 | echo "Running \`npm install\`" 5 | npm install 6 | fi 7 | 8 | echo "Running eleventy" 9 | eleventy $INPUT_ARGS 10 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Eleventy Action' 2 | description: 'Build your Eleventy-based static website' 3 | author: 'Sy Brand' 4 | inputs: 5 | args: 6 | description: 'Arguments to pass to the Eleventy invocation' 7 | required: false 8 | install_dependencies: 9 | description: 'If set to `true`, `npm install` will be run before Eleventy is invoked' 10 | required: false 11 | default: false 12 | runs: 13 | using: 'docker' 14 | image: 'Dockerfile' -------------------------------------------------------------------------------- /.github/workflows/test_build.yml: -------------------------------------------------------------------------------- 1 | name: Test Build 2 | on: [push] 3 | 4 | jobs: 5 | test: 6 | runs-on: ubuntu-18.04 7 | steps: 8 | - uses: actions/checkout@master 9 | - name: Build 10 | uses: TartanLlama/actions-eleventy@master 11 | - name: Deploy 12 | uses: peaceiris/actions-gh-pages@v1.1.0 13 | env: 14 | PUBLISH_DIR: _site 15 | PUBLISH_BRANCH: gh-pages 16 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action for Eleventy 2 | 3 | Use this action to build your static website with [Eleventy](https://www.11ty.io/). 4 | 5 | To use it, create a `.github/workflows/eleventy_build.yml` file which [uses this repository](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idsteps) as an action. 6 | 7 | Here's an example which builds the site with this action, then deploys to GitHub Pages with [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages): 8 | 9 | ```yaml 10 | name: Eleventy Build 11 | on: [push] 12 | 13 | jobs: 14 | build_deploy: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@master 18 | - name: Build 19 | uses: TartanLlama/actions-eleventy@master 20 | - name: Deploy 21 | uses: peaceiris/actions-gh-pages@v3 22 | with: 23 | publish_dir: _site 24 | publish_branch: gh-pages 25 | github_token: ${{ secrets.GITHUB_TOKEN }} 26 | ``` 27 | 28 | This action accepts a couple of optional inputs: 29 | 30 | | Input Name | Required? | Default | Description | 31 | | ---------------------- | :-------: | :-----: | ---------------------------------------------------------------------- | 32 | | `args` | No | `""` | Arguments to pass to the Eleventy invocation | 33 | | `install_dependencies` | No | `false` | If set to `true`, `npm install` will be run before Eleventy is invoked | 34 | 35 | For example: 36 | 37 | ```yaml 38 | - name: Build 39 | uses: TartanLlama/actions-eleventy@v1.3 40 | with: 41 | args: --output _dist 42 | install_dependencies: true 43 | ``` 44 | --------------------------------------------------------------------------------