-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow to rebuild the site + push output folder to netlify
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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 | ||
|
||
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 |