Skip to content

Commit afd5917

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

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

.circleci/config.yml

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

103-
publish:
103+
publish-dev:
104+
executor: build-executor
105+
steps:
106+
- run:
107+
name: Publish development pacts to broker
108+
command: npm run pact:publish-dev
109+
# - jobstatus
110+
111+
publish-prod:
104112
executor: build-executor
105113
steps:
106114
- attach_workspace:
107115
at: /tmp/workspace
108116
- setup_environment:
109117
version_path: /tmp/workspace
110118
- run:
111-
name: Publish pacts to broker
112-
command: npm run pact:publish
119+
name: Publish production pacts to broker
120+
command: cd /tmp/workspace && npm run pact:publish-prod
113121
- run:
114122
name: Publish package to NPM
115123
command: cd /tmp/workspace && npm publish
@@ -134,7 +142,16 @@ workflows:
134142
build-and-deploy:
135143
jobs:
136144
- build_test
137-
- publish:
145+
- publish-dev:
146+
context:
147+
- org-global
148+
- w3w-pact
149+
requires:
150+
- build_test
151+
filters:
152+
branches:
153+
ignore: master
154+
- publish-prod:
138155
context:
139156
- org-global
140157
- w3w-pact
@@ -145,5 +162,5 @@ workflows:
145162
only: master
146163
- tag:
147164
requires:
148-
- publish
165+
- publish-prod
149166

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)