Travis CI: How to set environment variables for a deployment script only?

In my configuration, .travis.yml

I would like to set up deployment to different stages (development / production) depending on the branch that caused the build. I am using a shell script for deployment i.e. Supplier script

.

Question: I need to pass different environment variables for different stages (mainly AWS keys). And these variables must be encrypted when stored in version control. So, I would like to do something like this:

deploy:
  - provider: script
    script: ./deploy.sh development
    env:
      -secure: <encrypted AWS_* variables for dev>
    on:
      branch: master
  - provider: script
    script: ./deploy.sh production
    env:
      -secure: <encrypted AWS_* variables for prod>
    on:
      branch: release

      

However, the key env

can only be used globally. Is it possible in some way to specify the environment for a specific script only, and not anything else?

+3


source to share





All Articles