From 0804ce91857fcca83f5a0d3f21a7a9b1597be0e4 Mon Sep 17 00:00:00 2001 From: Bobby Date: Fri, 6 May 2022 22:21:56 +0700 Subject: [PATCH] ci(actions): fix node_modules caching https://github.com/actions/setup-node/issues/416 --- .github/workflows/build.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cd053e8a..2c4cbd29a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,9 @@ on: - 'src/**/*.scss' - 'src/versions.json' +env: + NODE_VERSION: 16 + jobs: build: name: Rebuild client assets and bump v1 version string @@ -20,11 +23,18 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '16.x' - cache: 'yarn' + node-version: ${{ env.NODE_VERSION }} + + - name: Cache node_modules + uses: actions/cache@v2 + id: cache-nodemodules + with: + path: node_modules + key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }} - name: Install dependencies - run: yarn install + if: steps.cache-nodemodules.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile --non-interactive - name: Update browserslist/caniuse-lite run: npx browserslist@latest --update-db