From 1027b3e1eefc21e17d3b725785dede93d2faa7ab Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 22 Feb 2018 20:28:14 +0100 Subject: [PATCH] We must run the deploy command even on tag push. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case of tag push, travis will trigger a build but will set TRAVIS_BRANCH to the tag name, not "master". So by default, the deploy script will be skipped in case of tag push. There is a option "tags: true" to deploy on tag push. But it will run deploy script ONLY on tag push, not on cron build. So we need two "identical" deploy script, one for tags only and one for cron build. As we also need to activate travis build on push (because we push tags), travis will end to build twice a PR (one for the PR and one for the pushed branch). So we need to allow build only for `master` branches and tags. --- .travis.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d98901a..be696f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ language: cpp dist: trusty sudo: required +branches: + only: + - master + - /\d+\.\d+\.\d+$/ before_install: - eval "${MATRIX_EVAL}" - ${CXX} --version @@ -19,9 +23,17 @@ cache: install: travis/install_extra_deps.sh script: travis_wait 30 travis/compile_all.py deploy: - provider: script - skip_cleanup: true - script: travis/deploy.sh + - provider: script + skip_cleanup: true + script: travis/deploy.sh + on: + tags: true + - provider: script + skip_cleanup: true + script: travis/deploy.sh + on: + branch: master + condition: $TRAVIS_ENV_TYPE = cron env: global: - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"