Skip to content

Commit b4c8099

Browse files
committed
chore: extract setting up Node 12 in CI as a separate command
This pattern repeats throughout most of the CI jobs so simplify this repeating pattern.
1 parent db09271 commit b4c8099

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.circleci/config.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 2
1+
version: 2.1
22

33
default_machine_config: &default_machine_config
44
machine:
@@ -29,6 +29,20 @@ main_branches_filter: &main_branches_filter
2929
- staging
3030
- master
3131

32+
commands:
33+
setup_node12:
34+
description: Setup Node 12
35+
steps:
36+
- run:
37+
command: |
38+
export NVM_DIR="/opt/circleci/.nvm"
39+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
40+
nvm install v12
41+
npm install
42+
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
43+
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
44+
echo 'nvm use 12' >> $BASH_ENV
45+
3246
jobs:
3347
######################## PR OR MERGE TO STAGING ########################
3448
build_image:

0 commit comments

Comments
 (0)