diff --git a/.travis.yml b/.travis.yml index 55482cea4b..cbbc5a6a67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,10 @@ sudo: required language: go go_import_path: github.com/ethereum/go-ethereum services: skip -before_install: skip jobs: include: + - stage: Lint os: linux sudo: false @@ -15,6 +15,7 @@ jobs: submodules: false script: - go run build/ci.go lint + - stage: Build and test os: linux dist: trusty @@ -38,28 +39,59 @@ 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: Github release + script: + - make tomo + - mv build/bin/tomo build/bin/tomo-linux-amd64 + deploy: + provider: releases + api_key: $GITHUB_TOKEN + file: + - "build/bin/tomo-linux-amd64" + skip_cleanup: true + on: + branch: master + tags: true + + - stage: Build and push tomochain/tomochain image services: - docker before_install: - docker build -t tomochain/tomochain . - docker run tomochain/tomochain + install: skip + script: skip deploy: - provider: script - script: bash docker_push.sh - on: - branch: master + - provider: script + script: + - bash docker_push.sh latest + - bash docker_push.sh $TRAVIS_BUILD_ID + on: + branch: master + tags: false + - provider: script + script: + - bash docker_push.sh latest + - bash docker_push.sh $TRAVIS_TAG + on: + branch: master + tags: true + - stage: Trigger rebuild of tomochain/infra-tomochain image sudo: false + install: skip script: bash docker_rebuild.sh stages: - name: Lint - name: Build and test - - name: Build and push Docker image - if: type != pull_request AND branch = master - - name: Trigger rebuild of infrastructure image - if: type != pull_request AND branch = master + - name: Github release + if: type != pull_request AND branch = master AND tag = true AND repo = tomochain/tomochain + - name: Build and push tomochain/tomochain image + if: type != pull_request AND branch = master AND repo = tomochain/tomochain + - name: Trigger rebuild of tomochain/infra-tomochain image + if: type != pull_request AND branch = master AND repo = tomochain/tomochain notifications: slack: diff --git a/docker_push.sh b/docker_push.sh index 6008259b92..bc708c2730 100644 --- a/docker_push.sh +++ b/docker_push.sh @@ -1,7 +1,5 @@ #!/bin/bash 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 push tomochain/tomochain:latest -docker push tomochain/tomochain:$TRAVIS_BUILD_ID +docker tag tomochain/tomochain tomochain/tomochain:$1 +docker push tomochain/tomochain:$1