问题
I've linked my Android project repository to CircleCI and when I build, I got an gradlew lint error saying that google-services.json is not present. Is there any way to add google-services.json to my project, without committing it to the repository?
I'm using firebase as backend for my project
回答1:
disclaimer: CircleCI Developer Advocate
I'm not too familiar with google-services.json
so I'll mention a few possible solutions and you can see what might work best for you.
If the file is small enough, you can base64 encode the file, store it on CircleCI as a private environment variable, and then during a build decode the variable back to the file.
If an API key is the only secret part of the file, you could store the API key in a private environment variable, replace it in the file with template text such as
%API_KEY%
, and then during a build, replace the template text with the key usingsed
.Encrypt the entire file before committing it and store the decrypt key as a private environment variable.
Store the file somewhere secure and use SSH to retrieve it during a build.
Useful links: - CircleCI Environment Variables - sed - base64
来源:https://stackoverflow.com/questions/50671196/adding-google-services-json-for-circleci-to-function-on-a-public-repository