From cd1b69ce533620fa07a46031a6aca6886718e2c8 Mon Sep 17 00:00:00 2001 From: Aran Leite Date: Fri, 5 Jan 2024 15:19:17 -0300 Subject: [PATCH] Add cache in CD for Next.js --- .github/workflows/cd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ec80a55..5f3a083 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -24,6 +24,15 @@ jobs: node-version: "lts/*" cache: "pnpm" + - name: 🏗 Cache Next.js files + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/.next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- + - name: 📦 Install dependencies run: pnpm i