-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
91 lines (79 loc) · 2.55 KB
/
action.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: 'Install yarn dependencies'
description: 'Install yarn dependencies using cache'
inputs:
node-version:
description: 'The Node.js version to use'
required: false
yarn-args:
description: 'Arguments to use with yarn install'
required: false
runs:
using: composite
steps:
- name: 'Hash yarn args'
id: args
uses: myparcelnl/actions/hash-string@v4
with:
mode: 'args'
string: ${{ inputs.yarn-args }}
- uses: myparcelnl/actions/setup-node@v4
id: setup
with:
key: 'yarn'
node-version: ${{ inputs.node-version }}
- name: 'Create variables'
id: variables
shell: bash
#language=bash
run: |
version=$(yarn --version | cut -d. -f1)
if [ "$version" -ge "2" ]; then
echo "cache-folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
fi
echo "version=$version" >> $GITHUB_OUTPUT
- uses: myparcelnl/actions/create-cache-keys@v4
id: keys-yarn-download
with:
key: 'yarn-download'
input: |
${{ steps.setup.outputs.node-version }}
${{ hashFiles('yarn.lock') }}
- name: 'Cache yarn downloads'
if: steps.variables.outputs.version >= 2
uses: actions/cache@v4
id: yarn-download-cache
env:
RUNNER_DEBUG: 0
with:
path: ${{ steps.variables.outputs.cache-folder }}
key: ${{ steps.keys-yarn-download.outputs.key }}
restore-keys: ${{ steps.keys-yarn-download.outputs.restore-keys }}
- uses: myparcelnl/actions/create-cache-keys@v4
id: keys-yarn-install-state
with:
key: ${{ format('{0}{1}-yarn-install-state-', runner.os, runner.arch) }}
input: |
${{ steps.setup.outputs.node-version }}
${{ steps.args.outputs.hash }}
${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
- name: 'Cache yarn install state'
if: steps.variables.outputs.version >= 2
uses: actions/cache@v4
id: yarn-install-state-cache
env:
RUNNER_DEBUG: 0
with:
path: .yarn/ci-cache/
key: ${{ steps.keys-yarn-install-state.outputs.key }}
restore-keys: ${{ steps.keys-yarn-install-state.outputs.restore-keys }}
- name: 'Install yarn dependencies'
shell: bash
#language=bash
run: |
yarn install $ARGS
env:
ARGS: ${{ steps.args.outputs.string }}
HUSKY: '0'
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz
YARN_NM_MODE: 'hardlinks-local'