Skip to content

Commit df32f1e

Browse files
committed
chore: add CircleCI
1 parent 908befe commit df32f1e

2 files changed

Lines changed: 64 additions & 1 deletion

File tree

.circleci/config.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# https://circleci.com/blog/publishing-npm-packages-using-circleci-2-0/
2+
3+
version: 2
4+
5+
defaults: &defaults
6+
working_directory: ~/repo
7+
docker:
8+
- image: circleci/node:10.15.0
9+
10+
jobs:
11+
test:
12+
<<: *defaults
13+
steps:
14+
- checkout
15+
16+
- restore_cache:
17+
keys:
18+
- v1-dependencies-{{ checksum "package.json" }}
19+
# fallback to using the latest cache if no exact match is found
20+
- v1-dependencies-
21+
22+
- run: npm install
23+
- run:
24+
name: Run tests
25+
command: npm test
26+
27+
- save_cache:
28+
paths:
29+
- node_modules
30+
key: v1-dependencies-{{ checksum "package.json" }}
31+
32+
- persist_to_workspace:
33+
root: ~/repo
34+
paths: .
35+
deploy:
36+
<<: *defaults
37+
steps:
38+
- attach_workspace:
39+
at: ~/repo
40+
- run:
41+
name: Authenticate with registry
42+
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
43+
- run:
44+
name: Publish package
45+
command: npm publish
46+
47+
workflows:
48+
version: 2
49+
test-deploy:
50+
jobs:
51+
- test:
52+
filters:
53+
tags:
54+
only: /^v[0-9]+\.[0-9]+\.[0-9]/
55+
- deploy:
56+
requires:
57+
- test
58+
filters:
59+
tags:
60+
only: /^v[0-9]+\.[0-9]+\.[0-9]/
61+
branches:
62+
ignore: /.*/

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
},
1414
"scripts": {
1515
"build": "rimraf ./dist && tsc --build tsconfig.json",
16-
"start": "node ./dist/main.js"
16+
"start": "node ./dist/main.js",
17+
"test": "echo TODO: Tests"
1718
},
1819
"repository": {
1920
"type": "git",

0 commit comments

Comments
 (0)