Before_deploy is exeuted AFTER deploy.on.condition is evaluated


#1

Hi, I have a travis.yml with (roughly) the following content:

      before_deploy:
        - export PROJECT_VERSION=$(gradle -q printVersion)
      deploy:
        name: "${PROJECT_VERSION}"
        provider: releases
        api_key: "$GITHUB_OAUTH_TOKEN"
        skip_cleanup: true
        file_glob: true
        file: build/*-dist.zip
        prerelease: true
        on:
          jdk: oraclejdk8
          branch: master
          condition: $PROJECT_VERSION =~ /^.*SNAPSHOT$/

… which results in the following code in my travis_after_success script:

        if [[ ( $TRAVIS_BRANCH = master ) && ( $TRAVIS_JDK_VERSION = oraclejdk8 ) && ( $PROJECT_VERSION =~ /^.*SNAPSHOT$/ ) ]]; then
            if [[ $- = *e* ]]; then
                ERREXIT_SET=true;
            fi;
            set +e;
            travis_fold start before_deploy;
            travis_cmd export\ PROJECT_VERSION\=\$\(gradle\ -q\ printVersion\) --assert --echo --timing;

This is quite counter-intuitive given the structure of the yaml file. (The subnode of a subnode of a subling can practically invalidate a node which is on the same level as “deploy”).

I guess this behavior can not be changed at this point, but this fact can be stressed in the documentation.