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
travis-ci


source to share


No one has answered this question yet

See similar questions:

0
Travis will manually confirm the next step

or similar:

475
How to run travis-ci locally
8
Travis: different `script` for different branches?
7
In the public Travis repository, how to add a Secure variable that also works with Pull requests
3
Multiple values ​​of secure encrypted environment variable in .travis.yml
3
Multiple environments in Travis CI
1
What Travis CI environment variable will tell me if the secret environment variables are available for the current build?
0
Expand script does not run script
0
Travis skips S3 deployment because branch is not resolved
0
Django and travis CI secret key error with environment variables travis encode
0
Travis CI encrypted secret environment variables



All Articles
Loading...
X
Show
Funny
Dev
Pics