Skip to content

Commit 0851188

Browse files
authored
Merge pull request NarrativeScience-old#226 from NarrativeScience/feature/circleci
Adds automated package publishing via CircleCI
2 parents 9e798a3 + 497a452 commit 0851188

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

.circleci/config.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check {{ '/2.0/language-javascript/' | docs_url }} for more details
4+
#
5+
version: 2
6+
7+
defaults: &defaults
8+
docker:
9+
- image: circleci/node:12.16
10+
11+
jobs:
12+
test-server:
13+
<<: *defaults
14+
working_directory: ~/repo/server
15+
steps:
16+
- checkout
17+
path: ~/repo
18+
19+
- restore_cache:
20+
keys:
21+
- v1-dependencies-{{ checksum "package.json" }}
22+
# fallback to using the latest cache if no exact match is found
23+
- v1-dependencies-
24+
25+
- run: npm install
26+
- run:
27+
name: Run tests
28+
command: npm run type-check
29+
30+
- save_cache:
31+
paths:
32+
- node_modules
33+
key: v1-dependencies-{{ checksum "package.json" }}
34+
35+
- persist_to_workspace:
36+
root: ~/repo
37+
paths: server
38+
deploy-server:
39+
<<: *defaults
40+
working_directory: ~/repo/server
41+
steps:
42+
- attach_workspace:
43+
at: ~/repo/server
44+
- run:
45+
name: Authenticate with registry
46+
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
47+
- run:
48+
name: Publish package
49+
command: npm publish
50+
test-ui:
51+
<<: *defaults
52+
working_directory: ~/repo/ui
53+
steps:
54+
- checkout
55+
path: ~/repo
56+
57+
- restore_cache:
58+
keys:
59+
- v1-dependencies-{{ checksum "package.json" }}
60+
# fallback to using the latest cache if no exact match is found
61+
- v1-dependencies-
62+
63+
- run: npm install
64+
- run:
65+
name: Run tests
66+
command: npm test
67+
68+
- save_cache:
69+
paths:
70+
- node_modules
71+
key: v1-dependencies-{{ checksum "package.json" }}
72+
73+
- persist_to_workspace:
74+
root: ~/repo
75+
paths: ui
76+
deploy-ui:
77+
<<: *defaults
78+
working_directory: ~/repo/ui
79+
steps:
80+
- attach_workspace:
81+
at: ~/repo/ui
82+
- run:
83+
name: Authenticate with registry
84+
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
85+
- run:
86+
name: Publish package
87+
command: npm publish
88+
89+
workflows:
90+
version: 2
91+
test-deploy-server:
92+
jobs:
93+
- test-server:
94+
filters:
95+
tags:
96+
only: /^v.*/
97+
- deploy-server:
98+
requires:
99+
- test-server
100+
filters:
101+
tags:
102+
only: /^v.*/
103+
branches:
104+
ignore: /.*/
105+
test-deploy-ui:
106+
jobs:
107+
- test-ui:
108+
filters:
109+
tags:
110+
only: /^v.*/
111+
- deploy-ui:
112+
requires:
113+
- test-ui
114+
filters:
115+
tags:
116+
only: /^v.*/
117+
branches:
118+
ignore: /.*/

0 commit comments

Comments
 (0)