-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyarn-cache.yml
More file actions
72 lines (63 loc) · 1.6 KB
/
Copy pathyarn-cache.yml
File metadata and controls
72 lines (63 loc) · 1.6 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Yarn Cache
on:
workflow_call:
inputs:
runs-on:
default: ubuntu-latest
required: false
type: string
description: Use runs-on to define the type of machine to run the job on.
outputs:
key:
value: ${{ jobs.key.outputs.cache-key }}
path:
value: ${{ jobs.prime.outputs.cache-path }}
jobs:
key:
name: Key
runs-on: ${{ inputs.runs-on }}
outputs:
cache-key: ${{ steps.key.outputs.cache-key }}
steps:
- name: Checkout project
uses: actions/checkout@v6
- name: Install Node.js
id: node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Key
id: key
uses: johngeorgewright/workflows/actions/yarn-cache-key.yml@main
prime:
name: Prime
needs: [key]
runs-on: ${{ inputs.runs-on }}
env:
CACHE_PATH: |
~/.cache
.yarn/unplugged
.yarn/install-state.gz
concurrency:
group: ${{ needs.key.outputs.cache-key }}
outputs:
cache-path: ${{ env.CACHE_PATH }}
steps:
- name: Checkout project
uses: actions/checkout@v6
- name: Install Node.js
id: node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Cache
id: cache
uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATH }}
key: ${{ needs.key.outputs.cache-key }}
- name: Install Depedencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
corepack enable
yarn --immutable