diff --git a/.travis.yml b/.travis.yml index 55482cea4b..975aad1536 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ before_install: skip jobs: include: + - stage: Lint os: linux sudo: false @@ -15,6 +16,7 @@ jobs: submodules: false script: - go run build/ci.go lint + - stage: Build and test os: linux dist: trusty @@ -38,7 +40,8 @@ jobs: - while sleep 540; do echo "[ still running ]"; done & - go run build/ci.go test -coverage - kill %1 - - stage: Build and push tomochain/tomochain and tomochain/bootnode containers + + - stage: Build and push Docker image services: - docker before_install: @@ -46,16 +49,24 @@ jobs: - docker run tomochain/tomochain deploy: provider: script - script: bash docker_push.sh + script: bash docker_push.sh $TRAVIS_BUILD_ID on: - branch: master - - stage: Trigger rebuild of tomochain/infra-tomochain image + branch: master AND tag = false + deploy: + provider: script + script: bash docker_push.sh $TRAVIS_TAG + on: + branch: master AND tag = true + + - stage: Trigger rebuild of infrastructure image sudo: false script: bash docker_rebuild.sh stages: - name: Lint - name: Build and test + - name: Github release + if: type != pull_request AND branch = master AND tag = true - name: Build and push Docker image if: type != pull_request AND branch = master - name: Trigger rebuild of infrastructure image diff --git a/docker_push.sh b/docker_push.sh index 6008259b92..fadcc1f709 100644 --- a/docker_push.sh +++ b/docker_push.sh @@ -2,6 +2,6 @@ echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin docker tag tomochain/tomochain tomochain/tomochain:latest -docker tag tomochain/tomochain tomochain/tomochain:$TRAVIS_BUILD_ID +docker tag tomochain/tomochain tomochain/tomochain:$1 docker push tomochain/tomochain:latest -docker push tomochain/tomochain:$TRAVIS_BUILD_ID +docker push tomochain/tomochain:$1