Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

TravisCI: Add "secure" environment variables

Jean-Christophe Fillion-Robin edited this page Mar 6, 2023 · 3 revisions

⚠️ This page is currently out-of-date and may contain errors but is retained for historical reference.


Secure environment variables can be added in two ways:

  • using the project settings UI
  • using the TravisCI cli

using the project settings UI

travisci-adding-secure-env-variable-ui-1

using the TravisCI cli

Source: https://github.com/jcfr/docker-travis-cli#readme

  • First, pull the dockerized version of the CLI

    curl https://raw.githubusercontent.com/jcfr/docker-travis-cli/master/travis-cli.sh \
      -o ~/bin/travis-cli && \
    chmod +x ~/bin/travis-cli
  • Then, encrypt:

    travis-cli encrypt --repo org/repo SECRET="123"
  • Finally, add a section like the following at the end of .travis.yml where xxxxxxxx corresponds to the encrypted SECRET=123:

    env:
      global:
        - FOO=BAR
        - secure: "xxxxxxxx"
        - secure: "yyyyyyyy"