-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
26 lines (21 loc) · 864 Bytes
/
.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
sudo: required
services:
- docker
branches:
only:
- master
env:
# IMPORTANT! Add your docker slug here (commit once)
- DOCKER_REPO_SLUG=qinmen/blog-client
script:
# build latest image always
- docker build -t $DOCKER_REPO_SLUG:$TRAVIS_BUILD_NUMBER .
# build the tagged image
- if [[ $TRAVIS_TAG = $TRAVIS_BRANCH ]]; then docker build -t $DOCKER_REPO_SLUG:$TRAVIS_BRANCH .; else true ; fi
after_success:
# IMPORTANT! Add the environment variables in Travis Build Environment (one time!)
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
# push to latest if master branch
- if [[ $TRAVIS_BRANCH = master ]]; then docker push $DOCKER_REPO_SLUG:$TRAVIS_BUILD_NUMBER; else true; fi
# push tag as well
- if [[ $TRAVIS_TAG = $TRAVIS_BRANCH ]]; then docker push $DOCKER_REPO_SLUG:$TRAVIS_TAG; else true ; fi