Using Build Caching
Documentation is kind of sparse, but there is source code you can checkout to get an idea for how this is supposed to work:
- The actual, official
cache-utils
build code in Netlify Build- README is a good source of info
- Plugins that build on-top of cache functionality
jakejarvis/netlify-plugin-cache
: Generic wrapper around cache utiljlengstorf/netlify-plugin-gatsby-cache
: Popular plugin for re-using the Gatsby cache across Netlify builds
Scheduling Builds
Although you cannot yet set builds to run automatically on a schedule, it does not take many steps to setup a Github action that triggers a Netlify build on a CRON schedule.
This forum answer summarizes an approach to doing this, but I would add a caveat that you should probably store your webhook URL as a Github secret instead of hardcoding it into the action yml
, especially if your repo is public. Otherwise, anyone could see and grab your webhook URL, and spam POST requests to it to trigger tons of builds and run up your Netlify minutes / bill.
To use the webhook as a secret, just add it under the repo settings as NETLIFY_BUILD_WEBHOOK
, and then change the run command to run: curl -X POST -d {} ${{ secrets.NETLIFY_BUILD_WEBHOOK }}
.