Sunday, April 29, 2018

How to generate secret for API key for Heroku deployment using Travis CI

Intro

For some reasons recommended in the Travis-CI documentation, way does not work. Please find below what they recommend.

travis encrypt $(heroku auth:token) --add deploy.api_key

Travis-CI fails with the following error:

not logged in invalid option "--api_key="

How to generate a correct secure string

  1. Navigate to your Heroku account: https://dashboard.heroku.com/account
  2. Find API key section and copy key
 Heroku API Key

  1. Go to project root directory
  2. Run the following command:

travis encrypt <api-key> -r <github-user>/<repo-name> --add deploy.api_key

That script will add a secure string to .travis.yml.