Skip to content

Commit

Permalink
update travis script
Browse files Browse the repository at this point in the history
- fix broken script
- set go version 1.13.7
  • Loading branch information
bzon committed Feb 1, 2020
1 parent 096fef9 commit 5fd517a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
24 changes: 2 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branches:
- /^issue-\d+/

go:
- "1.13.x"
- "1.13.7"

sudo: false

Expand All @@ -23,27 +23,7 @@ script:
- make lint
- make coverage
- bash <(curl -s https://codecov.io/bash)
# Docker build and deployment
# Push only if:
# - triggered by a push to master
# - triggered by a push to a tag
# - not triggered by a pull request
# https://docs.travis-ci.com/user/environment-variables/
- |
export VERSION=${TRAVIS_TAG:-${TRAVIS_BRANCH}}
echo "Building app version $VERSION"
make all VERSION=${VERSION}
make docker VERSION=${VERSION}
echo ${DOCKER_PASSWORD} | docker login --password-stdin -u ${DOCKER_USER}
if [[ -n ${TRAVIS_TAG} || ${TRAVIS_BRANCH} == "master" ]]; then
docker-tag-latest VERSION=${VERSION}
make docker-push VERSION=latest
make docker-push VERSION=${VERSION}
fi
- bash ./travis.sh || travis_terminate 1
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
Expand Down
26 changes: 26 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

if [[ -n ${TRAVIS_PULL_REQUEST_BRANCH} ]]; then
export VERSION=${TRAVIS_PULL_REQUEST_BRANCH}
else
export VERSION=${TRAVIS_TAG:-${TRAVIS_BRANCH}}
fi

echo "Building app version $VERSION"

make all VERSION=${VERSION}
make docker VERSION=${VERSION}

if [[ -n ${TRAVIS_PULL_REQUEST_BRANCH} ]]; then
echo "Skip building docker images"
exit 0
fi

echo ${DOCKER_PASSWORD} | docker login --password-stdin -u ${DOCKER_USER}

if [[ -n ${TRAVIS_TAG} || ${TRAVIS_BRANCH} == "master" ]]; then
make docker-tag-latest VERSION=${VERSION}
make docker-push VERSION=latest
make docker-push VERSION=${VERSION}
fi

0 comments on commit 5fd517a

Please sign in to comment.