-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
43 lines (37 loc) · 1.14 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Cache Node Install
description: Installs Node dependencies and caches the result
branding:
color: yellow
icon: download
inputs:
node-version:
description: "Node version to use"
required: false
node-version-file:
description: "Node version file to use"
required: false
default: ".nvmrc"
runs:
using: "composite"
steps:
# Installs node and caches the global yarn cache (does not cache node_modules)
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version || '' }}
node-version-file: ${{ inputs.node-version-file || '' }}
cache: "yarn"
# Caches node_modules, breaks cache when yarn.lock is updated
- name: Cache dependencies
id: dependency-cache
uses: actions/cache@v4
with:
path: |
./node_modules
key: install-${{ hashFiles('**/.env','**/*lock*') }}
# Installs dependencies from the cached packages
# in the global yarn cache if the cache was broken
- name: Install dependencies
if: steps.dependency-cache.outputs.cache-hit != 'true'
run: yarn install
shell: bash