/
config.yml
119 lines (116 loc) · 3.22 KB
/
config.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# When in doubt, look up the CircleCI documentation, it has everything you need to know: https://circleci.com/docs/
version: 2.1
jobs:
build:
working_directory: ~/repo
docker:
- image: circleci/node:8.11
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
paths:
- node_modules
key: yarn-packages-{{ checksum "yarn.lock" }}
- persist_to_workspace:
root: ~/repo
paths: .
lint:
working_directory: ~/repo
# Pick a Docker image here: https://circleci.com/docs/2.0/circleci-images/
docker:
- image: circleci/node:8.11
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Run Linting
command: yarn lint
test:
working_directory: ~/repo
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Run Tests
command: yarn test
publish:
working_directory: ~/repo
docker:
- image: circleci/node:latest
steps:
- attach_workspace:
at: ~/repo
- run:
name: Authenticate with NPM Registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/repo/.npmrc
- run:
name: Publish New Package Version through npm
command: npm publish
website:
docker:
- image: circleci/node:8.11
working_directory: ~/repo/website
steps:
- checkout:
path: ~/repo
- restore_cache:
name: Restore node_modules cache
key: website-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- save_cache:
name: Save node_modules cache
key: website-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run: yarn build
- persist_to_workspace:
root: ./
paths:
- build/
workflows:
version: 2
build_to_production:
jobs:
- build:
filters:
tags:
only: /^v.*/
- lint:
requires:
- build
filters:
tags:
only: /^v.*/
- test:
requires:
- build
filters:
tags:
only: /^v.*/
- publish:
requires:
- build
- lint
- test
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- website