diff --git a/.github/workflows/pr-deploy.yml b/.github/workflows/pr-deploy.yml index 270c5b2785..c26f32b71e 100644 --- a/.github/workflows/pr-deploy.yml +++ b/.github/workflows/pr-deploy.yml @@ -26,6 +26,7 @@ jobs: with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' + cache: 'npm' - name: Restore cache uses: actions/cache@v2 with: @@ -45,6 +46,7 @@ jobs: with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' + cache: 'npm' - name: Restore cache uses: actions/cache@v2 with: @@ -94,10 +96,24 @@ jobs: with: node-version: '16.x' registry-url: 'https://registry.npmjs.org' + cache: 'npm' - name: Install run: npm install + - name: Restore build cache + uses: actions/cache@v3 + with: + # Gatsby requires both .cache and public. It will refuse to use .cache/ if public/ is not present. + path: | + .cache + public + # Cache will not be used by Gatsby if the following files change: + # https://www.gatsbyjs.com/docs/build-caching/ + key: pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-${{ github.ref }} + restore-keys: | + pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}- + - name: Build run: npm run build