Skip to content

Commit 777af92

Browse files
authored
Merge pull request #33 from erezrokah/add_cicd_publish
run npm publish on version tag push
2 parents 6ceb3ea + b1f6b1a commit 777af92

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

.circleci/config.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,27 @@ aliases:
4646
store_test_results:
4747
path: reports/junit
4848

49+
- &persist_to_workspace
50+
persist_to_workspace:
51+
root: ~/repo
52+
paths: .
53+
54+
- &attach_workspace
55+
attach_workspace:
56+
at: ~/repo
57+
58+
- &npm_authenticate
59+
run:
60+
name: Authenticate with registry
61+
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
62+
63+
- &npm_publish
64+
run:
65+
name: Publish package
66+
command: npm publish
67+
4968
jobs:
50-
build:
69+
test:
5170
<<: *container_config
5271

5372
steps:
@@ -59,3 +78,29 @@ jobs:
5978
- *run_prettier
6079
- *run_tests
6180
- *store_test_results
81+
- *persist_to_workspace
82+
83+
deploy:
84+
<<: *container_config
85+
86+
steps:
87+
- *attach_workspace
88+
- *npm_authenticate
89+
- *npm_publish
90+
91+
workflows:
92+
version: 2
93+
test-deploy:
94+
jobs:
95+
- test:
96+
filters:
97+
tags:
98+
only: /^v.*/
99+
- deploy:
100+
requires:
101+
- test
102+
filters:
103+
tags:
104+
only: /^v.*/
105+
branches:
106+
ignore: /.*/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"prettier": "prettier --write src/**/*.ts",
1313
"prettier:ci": "prettier --list-different src/**/*.ts",
1414
"tag": "git tag \"v$npm_package_version\" && git push --tags",
15-
"prepublishOnly": "yarn run tag && yarn lint && yarn run build"
15+
"prepublishOnly": "yarn run build"
1616
},
1717
"files": [
1818
"lib"

0 commit comments

Comments
 (0)