Can we deploy into different environments from the same branch?

From what I can see, the problem you are stuck at is how to trigger a deploy manually, without any additional commits.

There are two options here:

  • Trigger a custom build with a custom config alteration that would trigger the additional deploy logic. The caveat here is that a custom build can only be triggered for a branch tip, not an arbitrary commit.

    • travis.yml:
      deploy:
        - provider: script
          script: deploy_production.sh
          on:
            condition: $DEPLOY_PROD == 1
        - provider: script
          script: deploy_uat.sh
          on:
            condition: $DEPLOY_UAT == 1
      
    • custom config:
      merge_mode: deep_merge
      env:
        global:
          - DEPLOY_PROD=1
          - DEPLOY_UAT=1
      
  • Tag the commit (which would trigger a tag build) and make your deploy logic be triggered by the tag presence and/or name:

    deploy:
      - provider: script
        script: deploy_production.sh
        on:
          - tags: true
          - condition: $TRAVIS_TAG =~ ^prod
      - provider: script
        script: deploy_uat.sh
        on:
          - tags: true
          - condition: $TRAVIS_TAG =~ ^uat