-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstd_install_node_and_yarn_cache.yml
More file actions
45 lines (43 loc) · 1.38 KB
/
std_install_node_and_yarn_cache.yml
File metadata and controls
45 lines (43 loc) · 1.38 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
parameters:
executor:
type: executor
executor: << parameters.executor >>
steps:
- run:
name: Sparse Clone for Install
working_directory: /home/circleci
command: |
git clone --sparse "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" code
cd code
git checkout "${CIRCLE_SHA1}"
- run:
name: Checkout Critical Files for Install
working_directory: /home/circleci/code
command: |
git sparse-checkout set --no-cone .yarn/ .yalc/ /.yarnrc.yml /yarn.lock /package.json
# get patterns for package.json files in workspace
globs=$(cat package.json | jq '.workspaces[] | . + "/package.json"' -r)
for glob in ${globs}; do
git sparse-checkout add "${glob}"
done
- std_authenticate_yarn
- std_restore_cache:
cache_name: yarn
use_lockfile: true
- std_restore_cache:
cache_name: node
use_lockfile: true
- run:
name: Install Dependencies
working_directory: /home/circleci/code
command: |
yarn install --immutable
- std_save_cache:
cache_name: yarn
path: /home/circleci/code/.yarn/cache
path_2: /home/circleci/code/.yarn/install-state.gz
use_lockfile: true
- std_save_cache:
cache_name: node
path: /home/circleci/code/node_modules
use_lockfile: true