-
Notifications
You must be signed in to change notification settings - Fork 81
/
install.yml
92 lines (86 loc) · 3.31 KB
/
install.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
92
description: |
Install custom versions of Node.js, and optionally NPM/pnpm/Yarn, in any
execution environment (Docker/Linux, macOS, machine) that does not have
it preinstalled.
Recommendation: It is highly recommended to utilize an environment such as Docker with Node preinstalled.
parameters:
# node
node-version:
type: string
default: ''
description: >
Specify the full version tag to install. To install the latest version, set the version to `latest`.
If unspecified, the version listed in .nvmrc or .node-version will be installed. If no .nvmrc file and .node-version file exists the active LTS version of Node.js will be installed by default.
For a full list of releases, see the following: https://nodejs.org/en/download/releases
# pnpm
install-pnpm:
type: boolean
default: false
description: Install pnpm?
pnpm-version:
type: string
default: ''
description: >
Pick a version of pnpm to install (if no version is specified,
the latest stable version will be installed):
https://github.com/pnpm/pnpm/releases
# yarn
install-yarn:
type: boolean
default: false
description: Install Yarn?
yarn-version:
type: string
default: ''
description: >
Pick a version of Yarn to install (if no version is specified,
the latest stable version will be installed):
https://github.com/yarnpkg/yarn/releases
use-nvm-cache:
type: boolean
default: true
description: >
Indicates if cache would be used when installing nodejs,
this would reduce the amount of errors when downloading the binaries.
Defaults to true.
nvm-cache-key:
type: string
default: nvm-v1-cache
description: >
Cache key to use when downloading nodejs.
This is only used when use-nvm-cache is set to true.
Defaults to nvm-v1-cache, update this value if you need to restart the cache.
The node-version is added by default at the end of the cache key.
If you are using multiple executors, add the executor as part of the key.
steps:
- when:
condition: <<parameters.use-nvm-cache>>
steps:
- restore_cache:
name: Restore Nvm Cache
keys:
- <<parameters.nvm-cache-key>>-<<parameters.node-version>>
- run:
name: Install Node.js <<parameters.node-version>>
environment:
NODE_PARAM_VERSION: <<parameters.node-version>>
command: <<include(scripts/install-nvm.sh)>>
- when:
condition: <<parameters.use-nvm-cache>>
steps:
- save_cache:
name: Save Nvm Cache
key: <<parameters.nvm-cache-key>>-<<parameters.node-version>>
paths:
- ~/.nvm/.cache
- /opt/circleci/.nvm/.cache
- when:
condition: <<parameters.install-pnpm>>
steps:
- install-pnpm:
version: <<parameters.pnpm-version>>
- when:
condition: <<parameters.install-yarn>>
steps:
- install-yarn:
version: <<parameters.yarn-version>>