1 | # Javascript Node CircleCI 2.0 configuration file
|
2 | #
|
3 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details
|
4 | #
|
5 | version: 2
|
6 |
|
7 | defaults:
|
8 | working_directory: ~/repo
|
9 | docker:
|
10 | - image: circleci/node:8.9.1
|
11 |
|
12 | jobs:
|
13 | test:
|
14 | <<:
|
15 | steps:
|
16 | - checkout
|
17 |
|
18 | - restore_cache:
|
19 | keys:
|
20 | - v1-dependencies-{{ checksum "package.json" }}
|
21 | # fallback to using the latest cache if no exact match is found
|
22 | - v1-dependencies-
|
23 |
|
24 | - run: npm install
|
25 | - run: npm run build
|
26 | # - run:
|
27 | # name: Run tests
|
28 | # command: npm test
|
29 | - save_cache:
|
30 | paths:
|
31 | - node_modules
|
32 | key: v1-dependencies-{{ checksum "package.json" }}
|
33 |
|
34 | - persist_to_workspace:
|
35 | root: ~/repo
|
36 | paths: .
|
37 | deploy:
|
38 | <<:
|
39 | steps:
|
40 | - attach_workspace:
|
41 | at: ~/repo
|
42 | - run:
|
43 | name: Authenticate with registry
|
44 | command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
45 | - run:
|
46 | name: Publish package
|
47 | command: npm publish
|
48 |
|
49 | workflows:
|
50 | version: 2
|
51 | test-deploy:
|
52 | jobs:
|
53 | - test:
|
54 | filters:
|
55 | tags:
|
56 | only: /^v.*/
|
57 | - deploy:
|
58 | context: troven
|
59 | requires:
|
60 | - test
|
61 | filters:
|
62 | tags:
|
63 | only: /^v.*/
|