-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
45 lines (39 loc) · 1.29 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
37
38
39
40
41
42
43
44
45
sudo: required
env:
- DOCKER_IMAGE_NAME=cloudposse/openvpn
services:
- docker
install:
- |-
docker login \
--email="$DOCKER_HUB_EMAIL" \
--username="$DOCKER_HUB_USERNAME" \
--password="$DOCKER_HUB_PASSWORD"
script:
- docker build -t $DOCKER_IMAGE_NAME .
after_success:
- |-
if [ ! -z "$TRAVIS_TAG" ]; then \
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_TAG && \
docker push $DOCKER_IMAGE_NAME:$TRAVIS_TAG; \
fi
- |-
if [ ! -z "$TRAVIS_PULL_REQUEST_BRANCH" ]; then \
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:pr-$TRAVIS_PULL_REQUEST_BRANCH && \
docker push $DOCKER_IMAGE_NAME:pr-$TRAVIS_PULL_REQUEST_BRANCH; \
fi
- |-
if [[ -z "$TRAVIS_PULL_REQUEST_BRANCH" && ! -z "$TRAVIS_BRANCH" ]]; then \
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:$TRAVIS_BRANCH && \
docker push $DOCKER_IMAGE_NAME:$TRAVIS_BRANCH; \
fi
- |-
if [[ -z "$TRAVIS_TAG" && -z "$TRAVIS_PULL_REQUEST_BRANCH" && -z "$TRAVIS_BRANCH" ]]; then \
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest && \
docker push $DOCKER_IMAGE_NAME:latest; \
fi
- |-
if [[ -z "$TRAVIS_PULL_REQUEST_BRANCH" ]] && [[ "$TRAVIS_BRANCH" == "master" ]]; then \
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest && \
docker push $DOCKER_IMAGE_NAME:latest; \
fi