We must run the deploy command even on tag push.

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.
This commit is contained in:
Matthieu Gautier 2018-02-22 20:28:14 +01:00
parent ab1b16ebde
commit 1027b3e1ee
1 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,10 @@
language: cpp language: cpp
dist: trusty dist: trusty
sudo: required sudo: required
branches:
only:
- master
- /\d+\.\d+\.\d+$/
before_install: before_install:
- eval "${MATRIX_EVAL}" - eval "${MATRIX_EVAL}"
- ${CXX} --version - ${CXX} --version
@ -19,9 +23,17 @@ cache:
install: travis/install_extra_deps.sh install: travis/install_extra_deps.sh
script: travis_wait 30 travis/compile_all.py script: travis_wait 30 travis/compile_all.py
deploy: deploy:
provider: script - provider: script
skip_cleanup: true skip_cleanup: true
script: travis/deploy.sh 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: env:
global: global:
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"