-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (67 loc) · 2.26 KB
/
provider-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Provider pipeline
on:
push:
paths-ignore:
- "consumer-frontend/**"
workflow_dispatch:
env:
PACT_BROKER_BASE_URL: https://paulogoncalves.pactflow.io
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
jobs:
test-contract-provider:
runs-on: ubuntu-22.04
name: Run provider contract test
steps:
- name: Project checkout
uses: actions/checkout@v2
- run: docker-compose build provider-test-contract
- name: Run provider contract test
run: make provider-test-contract
# Runs on branches as well, so we know the status of our PRs
can-i-deploy-to-production:
runs-on: ubuntu-22.04
needs: test-contract-provider
name: Can deploy provider to 'production'?
steps:
- uses: actions/checkout@v2
- run: docker pull pactfoundation/pact-cli:0.50.0.14
- name: Can I deploy to production?
run: |
docker run --rm \
-e PACT_BROKER_BASE_URL \
-e PACT_BROKER_TOKEN \
pactfoundation/pact-cli:0.50.0.14 \
broker can-i-deploy \
--pacticipant clients-service \
--version ${{ github.sha }} \
--to-environment production
# Only deploy from main
deploy:
if: github.ref == 'refs/heads/main'
needs: can-i-deploy-to-production
runs-on: ubuntu-22.04
name: Deploy provider to 'production'
steps:
- uses: actions/checkout@v2
- name: Deploy
run: |
echo "\n========== STAGE: deploy ==========\n"
echo "Deploying to production"
echo "\n========== Deploy finished ==========\n"
associate-provider-application-version-with-production:
needs: deploy
runs-on: ubuntu-22.04
name: Associate provider application version with 'production'
steps:
- uses: actions/checkout@v2
- run: docker pull pactfoundation/pact-cli:0.50.0.14
- name: Associate provider application version with 'production' environment
run: |
docker run --rm \
-e PACT_BROKER_BASE_URL \
-e PACT_BROKER_TOKEN \
pactfoundation/pact-cli:0.50.0.14 \
broker record-deployment \
--pacticipant clients-service \
--version ${{ github.sha }} \
--environment production