Skip to content
This repository was archived by the owner on May 20, 2020. It is now read-only.

Commit ced3564

Browse files
committed
Add publish job to CircleCI configuration
The job publishes this project as a package to the npm registry. The trigger for the workflow that runs the `publish` job is the push of a git tag that matches a version pattern e.g. v1.2.0 See: https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag
1 parent 40da108 commit ced3564

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.circleci/config.yml

+46
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ references:
1818
attach_workspace:
1919
at: *workspace_root
2020

21+
filter_version_tag: &filter_version_tag
22+
tags:
23+
only:
24+
- /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
25+
branches:
26+
ignore: /.*/
27+
2128
jobs:
2229
build-node-10:
2330
executor: circleci-node-10
@@ -51,6 +58,20 @@ jobs:
5158
- *attach_workspace
5259
- run: npm test
5360

61+
publish:
62+
executor: circleci-node-10
63+
steps:
64+
- *attach_workspace
65+
- run:
66+
name: Configure registry.npmjs.org auth token
67+
command: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ${HOME}/.npmrc
68+
- run:
69+
name: Bump package version
70+
command: npm version ${CIRCLE_TAG}
71+
- run:
72+
name: Publish package to npm
73+
command: npm publish --access=public
74+
5475
workflows:
5576
version: 2
5677

@@ -64,3 +85,28 @@ workflows:
6485
- test-node-10:
6586
requires:
6687
- build-node-10
88+
89+
build-test-publish:
90+
jobs:
91+
- build-node-8:
92+
filters:
93+
<<: *filter_version_tag
94+
- build-node-10:
95+
filters:
96+
<<: *filter_version_tag
97+
- test-node-8:
98+
filters:
99+
<<: *filter_version_tag
100+
requires:
101+
- build-node-8
102+
- test-node-10:
103+
filters:
104+
<<: *filter_version_tag
105+
requires:
106+
- build-node-10
107+
- publish:
108+
filters:
109+
<<: *filter_version_tag
110+
requires:
111+
- test-node-8
112+
- test-node-10

0 commit comments

Comments
 (0)