-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
36 lines (30 loc) · 1.33 KB
/
.travis.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
sudo: required
language: bash
services:
- docker
env:
global:
- IMAGE_NAME=pperzyna/pact-example
addons:
apt:
packages:
- docker-ce
before_script:
- docker pull "${IMAGE_NAME}:provider" || true
- docker pull "${IMAGE_NAME}:consumer" || true
script:
- docker build --cache-from "${IMAGE_NAME}" --tag "${IMAGE_NAME}:consumer-${TRAVIS_COMMIT}" -f consumer/Dockerfile consumer/src/
- docker build --cache-from "${IMAGE_NAME}" --tag "${IMAGE_NAME}:provider-${TRAVIS_COMMIT}" -f provider/Dockerfile provider/src/
before_deploy:
- echo "$REGISTRY_PASS" | docker login --username "$REGISTRY_USER" --password-stdin || true
deploy:
- provider: script
skip_cleanup: true
script: docker tag "${IMAGE_NAME}:consumer-${TRAVIS_COMMIT}" "${IMAGE_NAME}:consumer" && docker push "${IMAGE_NAME}:consumer"; docker tag "${IMAGE_NAME}:provider-${TRAVIS_COMMIT}" "${IMAGE_NAME}:provider" && docker push "${IMAGE_NAME}:provider"
on:
branch: master
- provider: script
skip_cleanup: true
script: docker tag "${IMAGE_NAME}:consumer-${TRAVIS_COMMIT}" "${IMAGE_NAME}:consumer-${TRAVIS_TAG}" && docker push "${IMAGE_NAME}:consumer-${TRAVIS_TAG}"; docker tag "${IMAGE_NAME}:provider-${TRAVIS_COMMIT}" "${IMAGE_NAME}:provider-${TRAVIS_TAG}" && docker push "${IMAGE_NAME}:provider-${TRAVIS_TAG}"
on:
tags: true