I recently wanted to post notifications from Travis builds in a Slack channel. There is a Travis app in Slack which does exactly that.
They also recommend to encrypt this key. The easiest way is to install their gem to do this:
$ gem install travis $ rbenv rehash $ travis encrypt nameofyourkey:7q5uXtQcekdHMFRH9EGPeK6K Shell completion not installed. Would you like to install it now? |y| n Detected repository as `name/repository-name`, is this correct? |yes| y Please add the following to your .travis.yml file: secure: "LOADS AND LOADS OF GIBBERISH" Pro Tip: You can add it automatically by running with --add.
The pro tip was like when you read beware stickers like "don't turn me upside down" in the upside down side. TOO LATE.
nameofyourkey is all lowercase and with no spaces.
Also, if you do as the pro tip says:
$ travis encrypt SLACK_API_KEY="nameofyourkey:7q5uXtQcekdHMFRH9EGPeK6K" --add
Then you need to pass the variable name
SLACK_API_KEY, but this produces no output and adds this to your travis file:
env: global: secure: THE SAME GIBBERISH BUT WITHOUT QUOTES
What you really want to do is to use the first command and add:
notifications: slack: secure: "blah"
to your travis file. I don't know if there is a command to add this automatically, but the Pro Tip has failed me again, he he.