diff --git a/.travis.yml b/.travis.yml index cf5e776e..efc51508 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,6 @@ dist: xenial # https://docs.travis-ci.com/user/reference/xenial/ language: node_js cache: yarn -env: - global: - # value is master if tag build AND on master https://github.com/travis-ci/travis-ci/issues/5419#issuecomment-222815942 - - BRANCH_OF_TAG=$(git branch --contains $TRAVIS_TAG | grep -l '^[\* ] master$') before_install: - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 - export PATH="$HOME/.yarn/bin:$PATH" @@ -33,13 +29,13 @@ after_success: - wget https://raw.githubusercontent.com/k3rn31p4nic/travis-ci-discord-webhook/master/send.sh - chmod +x send.sh - ./send.sh success $DISCORD_WEBHOOK_URL - - echo after_success TRAVIS_BRANCH=$TRAVIS_BRANCH BRANCH_OF_TAG=$BRANCH_OF_TAG TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST TRAVIS_TAG=$TRAVIS_TAG TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER TRAVIS_COMMIT=$TRAVIS_COMMIT ; + - echo after_success TRAVIS_BRANCH=$TRAVIS_BRANCH TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST TRAVIS_TAG=$TRAVIS_TAG TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER TRAVIS_COMMIT=$TRAVIS_COMMIT ; - | if [ $TRAVIS_PULL_REQUEST == "false" ]; then - if [ $TRAVIS_BRANCH == "master" ] || [ $BRANCH_OF_TAG == "master" ]; then + if [ $TRAVIS_BRANCH == "master" ] || [[ $TRAVIS_TAG =~ v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin ; yarn docker:tag:build ; - if [ ! -z "$VERSION_TAG" ]; then + if [ ! -z $TRAVIS_TAG ]; then yarn docker:tag:version $TRAVIS_TAG; fi yarn docker:tag:latest; # NB: it will tag old version with latest if you tag an old commit on master