Commiting google-services.json to GitHub

前端 未结 2 1852
粉色の甜心
粉色の甜心 2020-12-23 22:23

I am creating a public android project and I am using Google Sign-In service. I am doing it according to this tutorial. As it says, I have got the google-services.json file.

2条回答
  •  佛祖请我去吃肉
    2020-12-23 22:29

    You can use travis encrypt-file google-services.json

    Documentation

    You can do it by:

    • installed the Travis CI Command Line Client by running $ gem install travis.

    • logged in to Travis CI using $ travis login or $ travis login --pro

      $ travis encrypt-file super_secret.txt
      encrypting super_secret.txt for rkh/travis-encrypt-file-example
      storing result as super_secret.txt.enc
      storing secure env variables for decryption
      

    Then it will print on the console this:

    openssl aes-256-cbc -K $encrypted_0a6446eb3ae3_key -iv $encrypted_0a6446eb3ae3_iv -in super_secret.txt.enc -out super_secret.txt -d

    You can copy it to your .travis.yml file as I did here

    Do not forget to put your .enc file on your GitHub repository.

    If you have multiple files, you could zip them and then you unzip the decrypted file on the Travis ci.

    For instance, you can do like this:

    $ tar cvf secrets.tar foo bar
    $ travis encrypt-file secrets.tar
    $ vi .travis.yml
    $ git add secrets.tar.enc .travis.yml
    $ git commit -m 'use secret archive'
    $ git push
    

    I did it.

    In my case, I had two files to use on the build of my app. So, I used this due to travis does not support multiple encrypted files. Therefore, you zip then on one file and encrypt this file.

    You can have a look at my travis script here

提交回复
热议问题