1 | version: 2
|
2 |
|
3 | defaults:
|
4 | working_directory: ~/repo
|
5 | docker:
|
6 | - image: circleci/node:8.9.1
|
7 |
|
8 | jobs:
|
9 | test:
|
10 | <<:
|
11 | steps:
|
12 | - checkout
|
13 | - restore_cache:
|
14 | keys:
|
15 | - v1-dependencies-
|
16 | - v1-dependencies-
|
17 | - run: npm install
|
18 | - run: npm run eslint
|
19 | - run: npm run test-ci
|
20 | - save_cache:
|
21 | paths:
|
22 | - node_modules
|
23 | key: v1-dependencies-
|
24 | - persist_to_workspace:
|
25 | root: ~/repo
|
26 | paths: .
|
27 |
|
28 | deploy:
|
29 | <<:
|
30 | steps:
|
31 | - attach_workspace:
|
32 | at: ~/repo
|
33 | - run:
|
34 | name: Authenticate with registry
|
35 | command: echo "//registry.npmjs.org/:_authToken=$npm_token" > ~/repo/.npmrc
|
36 | - run:
|
37 | name: Publish package
|
38 | command: npm publish
|
39 |
|
40 | workflows:
|
41 | version: 2
|
42 | test-deploy:
|
43 | jobs:
|
44 | - test:
|
45 | filters:
|
46 | tags:
|
47 | only: /.*/
|
48 | - deploy:
|
49 | filters:
|
50 | tags:
|
51 | only: /.*/
|
52 | requires:
|
53 | - test
|