1 | defaults:
|
2 | docker:
|
3 | - image: circleci/node:8.11.2
|
4 |
|
5 | version: 2
|
6 | jobs:
|
7 | test:
|
8 | <<:
|
9 | steps:
|
10 | - checkout
|
11 | - restore_cache:
|
12 | key: node-modules-{{ checksum "package-lock.json" }}
|
13 | - run: npm install
|
14 | - save_cache:
|
15 | key: node-modules-{{ checksum "package-lock.json" }}
|
16 | paths:
|
17 | - node_modules
|
18 | - run: npm test
|
19 | - run: npm run build
|
20 | - persist_to_workspace:
|
21 | root: .
|
22 | paths:
|
23 | - dist
|
24 | release:
|
25 | <<:
|
26 | steps:
|
27 | - checkout
|
28 | - attach_workspace:
|
29 | at: .
|
30 | - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
31 | - run: npm publish
|
32 |
|
33 | workflows:
|
34 | version: 2
|
35 | build:
|
36 | jobs:
|
37 | - test:
|
38 | filters:
|
39 | tags:
|
40 | only: /.*/
|
41 | - release:
|
42 | filters:
|
43 | branches:
|
44 | ignore: /.*/
|
45 | tags:
|
46 | only: /v[0-9]+(\.[0-9]+)*/
|
47 | requires:
|
48 | - test
|