Skip to content

Commit

Permalink
feat(yarn-install): improve speed
Browse files Browse the repository at this point in the history
- now caches node_modules instead of yarn cache
  • Loading branch information
EdieLemoine committed May 18, 2022
1 parent ccce312 commit 0572ddf
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions yarn-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@ inputs:
runs:
using: composite
steps:
- uses: myparcelnl/actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}

- name: 'Get yarn cache directory path'
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
shell: bash

- name: 'Prepare yarn cache'
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: 'Prepare node_modules cache'
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: node_modules
key: ${{ runner.os }}-yarn-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-yarn-node_modules-
- name: 'Install yarn dependencies'
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
shell: bash

0 comments on commit 0572ddf

Please sign in to comment.