-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 2.04 KB
/
--yarn-install-current.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
name: '🔸 Yarn install - Current'
on:
workflow_call:
inputs:
cache-key:
description: 'Cache key to use'
type: string
default: ''
required: false
jobs:
install:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: node -v
shell: bash
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
- run: node -v
shell: bash
- name: 'Create variables'
id: variables
shell: bash
#language=bash
run: |
version=$(yarn --version | cut -d. -f1)
if [ "$version" -lt "2" ]; then
echo "args=--frozen-lockfile" >> $GITHUB_OUTPUT
else
echo "cache-folder=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
fi
echo "version=$version" >> $GITHUB_OUTPUT
- name: 'Cache yarn downloads'
if: steps.variables.outputs.version >= 2
uses: actions/cache@v4
id: yarn-download-cache
with:
path: ${{ steps.variables.outputs.cache-folder }}
key: ${{ inputs.cache-key }}-yarn-download-${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ inputs.cache-key }}-yarn-download-${{ inputs.node-version }}-
- name: 'Cache yarn install state'
if: steps.variables.outputs.version >= 2
uses: actions/cache@v4
id: yarn-install-state-cache
with:
path: .yarn/ci-cache/
key: ${{ inputs.cache-key }}-${{ runner.os }}-yarn-install-state-${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock', '**/.yarnrc.yml') }}
- name: 'Install yarn dependencies'
shell: bash
#language=bash
run: |
yarn install ${{ steps.variables.outputs.args }} ${{ inputs.yarn-args }}
env:
HUSKY: '0'
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz
YARN_NM_MODE: 'hardlinks-local'