# Before\_deploy is exeuted AFTER deploy.on.condition is evaluated

**URL:** <https://travis-ci.community/t/before-deploy-is-exeuted-after-deploy-on-condition-is-evaluated/2104>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [February 3, 2019, 8:01pm UTC](https://travis-ci.community/t/before-deploy-is-exeuted-after-deploy-on-condition-is-evaluated/2104 "2019-02-03T20:01:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbence](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@vbence](https://travis-ci.community/u/vbence)\
**Post date:** [February 3, 2019, 8:01pm UTC](https://travis-ci.community/t/before-deploy-is-exeuted-after-deploy-on-condition-is-evaluated/2104/1 "2019-02-03T20:01:20Z")

</div>

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

```auto
      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:

```auto
        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.
