UNPKG

2.06 kBYAMLView Raw
1version: 2
2
3buildSteps: &buildSteps
4 - checkout
5 - run:
6 name: Install
7 command: npm install --loglevel warn
8 - run:
9 name: Test
10 command: npm test --loglevel warn
11 - persist_to_workspace:
12 # Persist all job output, so we can (potentially) use it for deploys
13 root: ../
14 paths:
15 - ./node-*
16
17jobs:
18 node-6:
19 docker:
20 - image: circleci/node:6
21 working_directory: ~/node-6
22 steps: *buildSteps
23
24 node-8:
25 docker:
26 - image: circleci/node:8
27 working_directory: ~/node-8
28 steps: *buildSteps
29
30 node-10:
31 docker:
32 - image: circleci/node:10
33 working_directory: ~/node-10
34 steps: *buildSteps
35
36 deploy:
37 # For this to work NPM_TOKEN must be set for the account used for publishing
38 docker:
39 - image: circleci/node:8
40 steps:
41 - attach_workspace:
42 at: $CIRCLE_WORKING_DIRECTORY
43 - run:
44 name: Login
45 command: |
46 echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
47 npm whoami
48 - deploy:
49 name: Deploy
50 command: npm publish
51 # Output used for publish is from node 8 build
52 working_directory: $CIRCLE_WORKING_DIRECTORY/node-8
53
54workflows:
55 version: 2
56 build:
57 jobs:
58 - node-6:
59 # Run for all tags (required to allow the deploy to trigger on version tags)
60 filters:
61 tags:
62 only: /.*/
63 - node-8:
64 # Run for all tags (required to allow the deploy to trigger on version tags)
65 filters:
66 tags:
67 only: /.*/
68 - node-10:
69 # Run for all tags (required to allow the deploy to trigger on version tags)
70 filters:
71 tags:
72 only: /.*/
73 - deploy:
74 # Deploy passing builds if they're tagged with a version
75 requires:
76 - node-6
77 - node-8
78 - node-10
79 filters:
80 tags:
81 only: /^v\d+\.\d+\.\d+$/
82 branches:
83 ignore: /.*/