Set up NextJS build cache for faster GitHub Actions build times
brianespinosa/next-build-cache@main
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: brianespinosa/checkout-setup-node-install@main
- uses: brianespinosa/next-build-cache@main
- run: yarn build
- We are handling install caching with other tools like
node-setup
orbrianespinosa/checkout-setup-node-install
- We are using
yarn
as our package manager so we can leverage ayarn.lock
file to generate part of our build cache hash - This action runs immediately before a NextJS build command to look for a build cache (post-job actions will automatically save the build cache upon build completion)