Skip to content

Commit

Permalink
Change caching strategy according to next.js docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansive committed Dec 20, 2023
1 parent 3d832a8 commit 0ee9d83
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
paths:
- src/**
workflow_dispatch:

jobs:
publish:
Expand All @@ -20,7 +21,16 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 21.x
cache: npm
- uses: actions/cache@v3
with:
path: |
~/.npm
${{ 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: npm ci
Expand All @@ -29,7 +39,7 @@ jobs:
run: npx @cloudflare/next-on-pages@1

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Expand Down

0 comments on commit 0ee9d83

Please sign in to comment.