ir2pid
ir2pid

Reputation: 6136

How to encrypt auth key in github and integrate with Travis CI?

I want to encrypt my Android project's auth keys in my gradle.properties file when pushing to GitHub. But the issue is the tests on Travis fail due to auth error.

Is there any way I can make Travis CI decrypt the auth keys before building the app?

Local repo ---(encrypt)---(push)---> Githut ---(pull)---(decrypt)---> Travis build

Upvotes: 0

Views: 151

Answers (1)

heldic
heldic

Reputation: 405

Check this piece of the documentation for environment variables. Pay attention to include the --add. It'll add the decryption part to your .travis.yml.

This works for environment variables but can also be done with files as described here. You could do this with gradle.properties. It'll leave you with:

$ travis encrypt-file gradle.properties --add
encrypting gradle.properties for <REPOSITORY>
storing result as gradle.properties.enc
storing secure env variables for decryption

Make sure to add gradle.properties.enc to the git repository.
Make sure not to add gradle.properties to the git repository.
Commit all changes to your .travis.yml.

For multiple files: Just create an archive.

Upvotes: 1

Related Questions