Use builtin cache logic in setup-node action for GitHub Actions

This commit is contained in:
Björn Dahlgren 2021-10-07 21:30:26 +02:00
parent 7b6d0c6425
commit 4d590e5e26

View File

@ -31,22 +31,10 @@ jobs:
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm dependencies
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ matrix.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ matrix.os }}-node-${{ matrix.node-version }}-
cache: npm
- name: Install npm dependencies
run: npm install