Skip to content

Commit 07112a4

Browse files
authored
Merge pull request #107 from pactflow/test
Deploy to test env
2 parents 3d39056 + 741ba9a commit 07112a4

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ jobs:
5757
- run: docker pull pactfoundation/pact-cli:latest
5858
- name: Deploy
5959
run: GIT_BRANCH=${GIT_REF:11} make deploy
60-
if: github.ref == 'refs/heads/master'
60+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/test'

Makefile

+15-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ GITHUB_WEBHOOK_UUID := "04510dc1-7f0a-4ed2-997d-114bfa86f8ad"
1010
PACT_CLI="docker run --rm -v ${PWD}:${PWD} -e PACT_BROKER_BASE_URL -e PACT_BROKER_TOKEN pactfoundation/pact-cli"
1111

1212
.EXPORT_ALL_VARIABLES:
13-
GIT_COMMIT=$(shell git rev-parse HEAD)
14-
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
13+
GIT_COMMIT?=$(shell git rev-parse HEAD)
14+
GIT_BRANCH?=$(shell git rev-parse --abbrev-ref HEAD)
15+
ENVIRONMENT?=production
1516

16-
# Only deploy from master
17+
# Only deploy from master (to production env) or test (to test env)
1718
ifeq ($(GIT_BRANCH),master)
19+
ENVIRONMENT=production
1820
DEPLOY_TARGET=deploy
1921
else
20-
DEPLOY_TARGET=no_deploy
22+
ifeq ($(GIT_BRANCH),test)
23+
ENVIRONMENT=test
24+
DEPLOY_TARGET=deploy
25+
else
26+
DEPLOY_TARGET=no_deploy
27+
endif
2128
endif
2229

2330
all: test
@@ -65,16 +72,16 @@ can_i_deploy: .env
6572
@"${PACT_CLI}" broker can-i-deploy \
6673
--pacticipant ${PACTICIPANT} \
6774
--version ${GIT_COMMIT} \
68-
--to-environment production \
69-
--retry-while-unknown 0 \
75+
--to-environment ${ENVIRONMENT} \
76+
--retry-while-unknown 30 \
7077
--retry-interval 10
7178

7279
deploy_app:
7380
@echo "\n========== STAGE: deploy ==========\n"
74-
@echo "Deploying to production"
81+
@echo "Deploying to ${ENVIRONMENT}"
7582

7683
record_deployment: .env
77-
@"${PACT_CLI}" broker record-deployment --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --environment production
84+
@"${PACT_CLI}" broker record-deployment --pacticipant ${PACTICIPANT} --version ${GIT_COMMIT} --environment ${ENVIRONMENT}
7885

7986
## =====================
8087
## Pactflow set up tasks

0 commit comments

Comments
 (0)