# .github/workflows/deploy.yml, the build job's steps
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- uses: actions/cache@v4
with:
path: |
.stati
dist
key: stati-${{ hashFiles('site/**', 'stati.config.ts') }}
restore-keys: stati-
- run: npm run build
.stati/manifest.json records what each page was built from, and dist/ holds the pages themselves. The cache is only of use with both, so they go in the same cache entry.
restore-keys brings back the newest cache even when the key has changed, so a content change starts from the last build rather than from nothing. A host that starts every build clean, like Netlify, needs its own cache setting for the two folders.
A cached page keeps everything a template worked out from the current date, like "3 days ago" or the year in the footer, until its TTL runs out. Give such pages a short ttlSeconds, or build with --force now and then.
In the Stati docs: Cache persistence and ISG settings.