-
Notifications
You must be signed in to change notification settings - Fork 84
/
.travis.yml
66 lines (54 loc) · 1.67 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
env:
global:
# Should be encrypted or set as private travis variables (in travis settings):
# DOCKER_HUB_USERNAME
# DOCKER_HUB_PASSWORD
- DOCKER_REPOSITORY="z3rogate/cflint"
language: java
# Forces travis to use VM insted container, required to be able to build containers.
sudo: required
jdk:
- openjdk8
services:
- docker
install: true
before_script:
# Print build info that binary is compiled with.
- echo $TRAVIS_COMMIT
- echo $TRAVIS_TAG
- echo $TRAVIS_BRANCH
- echo $TRAVIS_BUILD_NUMBER
- echo $TRAVIS_REPO_SLUG
- chmod +x gradlew
- ./gradlew test
script:
- docker build -t ${DOCKER_REPOSITORY} .
- docker run --rm -it ${DOCKER_REPOSITORY} -version
after_script:
- docker images
before_deploy:
# Master is always lastest
- if [ ! -z "$TRAVIS_TAG" ]; then export IMAGE_TAG=$TRAVIS_TAG; else export IMAGE_TAG=$TRAVIS_BRANCH; fi
# Upload image to docker registry only on PUSH
- docker tag $DOCKER_REPOSITORY:latest $DOCKER_REPOSITORY:$IMAGE_TAG;
- docker login --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;
- docker push $DOCKER_REPOSITORY:$IMAGE_TAG;
- if [ "$TRAVIS_BRANCH" = master ]; then
export COMMIT_TAG="$TRAVIS_BRANCH"_"$TRAVIS_COMMIT";
docker tag $DOCKER_REPOSITORY:latest $DOCKER_REPOSITORY:$COMMIT_TAG;
docker push $DOCKER_REPOSITORY:$COMMIT_TAG;
fi;
deploy:
# Force before_deploy for branches
-
provider: script
script: /bin/true
on:
all_branches: true
# Force before_deploy for tags
-
provider: script
script: /bin/true
on:
tags: true
all_branches: true