-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (35 loc) · 1.2 KB
/
rebuild-and-publish-to-netlify.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Builds the site on GitHub because GitHub offers 2000 free CI/CD minutes, while Netlify offers 300.
# See: https://bennypowers.dev/posts/cheap-netlify-11ty-rebuilds/
name: Rebuild Netlify site
on:
push:
branches:
- main
paths:
- 'public/**'
- 'src/**'
- eleventy.config.drafts.js
- eleventy.config.images.js
- eleventy.config.js
- netlify.toml
jobs:
rebuild:
runs-on: ubuntu-latest
name: Rebuild site
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
# use cached node_modules if found (instead of running npm install)
- run: npm ci --prefer-offline
- run: npm run build
- name: Publish to Netlify
env:
# Netlify settings "Site name"
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# Netlify personal access token created here: https://app.netlify.com/user/applications
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# Deploy updated "_site" folder to production Netlify branch
run: npx netlify-cli deploy --prod --message "deploy from GitHub Action" --dir=_site