Installing Travis cli

travis CI

A reminder to myself on how to install the Travis CLI command-line tool on Ubuntu (which is the only time I ever make use of Ruby, and which I only ever do when installing a fresh OS).

  1. Install Ruby.

    $ sudo apt install ruby ruby-dev
    
  2. Install the Travis gem.

    gem install --user-install travis
    

    The output of this will include a warning that “You don’t have /home/​phlummox/​.gem/​ruby/​2.5.0/​bin [or something similar] in your PATH, gem executables will not run”.

  3. So ensure it’s added next time you log in:

    $ echo 'PATH=$HOME/.gem/ruby/2.5.0/bin:$PATH' >> ~/.profile
    

    (And source ~/.profile, to update your path right now.)

  4. Run travis login, OR (more likely) travis login --pro, to authenticate with the Travis CLI servers using GitHub. The former logs you in to travis-ci.org, the latter to travis-ci.com; the .org server will eventually be deprecated, IIRC.

  5. Do whatever Travis-related task you needed to do. Probably, something like

    $ travis encrypt --pro DOCKER_USERNAME=my-user-name --add env.global
    $ travis encrypt --pro DOCKER_PASSWORD=my-password  --add env.global