Skip to content

Commit 5ef667e

Browse files
committed
ci(circleci): publish dev and prod pacts
1 parent 4e90a30 commit 5ef667e

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

.circleci/config.yml

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,35 @@ jobs:
100100
- ./package.json
101101
# - jobstatus
102102

103-
publish:
103+
pact-publish-dev:
104+
executor: build-executor
105+
steps:
106+
- checkout
107+
- setup_environment
108+
- node/install-packages
109+
- run:
110+
name: Publish development pacts to broker
111+
command: npm run pact:publish-dev
112+
# - jobstatus
113+
114+
pact-publish-prod:
115+
executor: build-executor
116+
steps:
117+
- checkout
118+
- setup_environment
119+
- node/install-packages
120+
- run:
121+
name: Publish production pacts to broker
122+
command: npm run pact:publish-prod
123+
# - jobstatus
124+
125+
npm-publish:
104126
executor: build-executor
105127
steps:
106128
- attach_workspace:
107129
at: /tmp/workspace
108130
- setup_environment:
109131
version_path: /tmp/workspace
110-
- run:
111-
name: Publish pacts to broker
112-
command: npm run pact:publish
113132
- run:
114133
name: Publish package to NPM
115134
command: cd /tmp/workspace && npm publish
@@ -134,7 +153,16 @@ workflows:
134153
build-and-deploy:
135154
jobs:
136155
- build_test
137-
- publish:
156+
- pact-publish-dev:
157+
context:
158+
- org-global
159+
- w3w-pact
160+
requires:
161+
- build_test
162+
filters:
163+
branches:
164+
ignore: master
165+
- pact-publish-prod:
138166
context:
139167
- org-global
140168
- w3w-pact
@@ -143,7 +171,15 @@ workflows:
143171
filters:
144172
branches:
145173
only: master
174+
- npm-publish:
175+
context:
176+
- org-global
177+
requires:
178+
- build_test
179+
filters:
180+
branches:
181+
only: master
146182
- tag:
147183
requires:
148-
- publish
184+
- npm-publish
149185

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"pact_do_not_track": true
2121
},
2222
"scripts": {
23-
"pact:publish": "pact-broker publish pacts --consumer-app-version=\"$npm_package_version-$(git rev-parse --short HEAD)\" --auto-detect-version-properties --broker-base-url=${PACT_BROKER_BASE_URL}",
23+
"pact:publish-dev": "pact-broker publish pacts --consumer-app-version=\"$npm_package_version-$(git rev-parse --short HEAD)\" --auto-detect-version-properties --broker-base-url=${PACT_BROKER_BASE_URL}",
24+
"pact:publish-prod": "pact-broker publish pacts --consumer-app-version=\"$npm_package_version\" --auto-detect-version-properties --broker-base-url=${PACT_BROKER_BASE_URL}",
2425
"test": "jest",
2526
"test:watch": "jest --watch",
2627
"coverage": "jest --coverage",

0 commit comments

Comments
 (0)