google / secrets-gradle-plugin

A Gradle plugin for providing your secrets to your Android project.
Apache License 2.0
1.13k stars 99 forks source link

"defaultPropertiesFileName" should be mentioned in examle usage or installation #47

Closed KonradKarimi closed 2 years ago

KonradKarimi commented 2 years ago

Hello,

I've been struggling to use this plugin in my GitHub actions workflow. Locally everything worked fine. On GitHub action I've got known error:

Attribute meta-data#com.google.android.geo.API_KEY@value at AndroidManifest.xml:32:13-44 requires a placeholder substitution but no value for <GOOGLE_MAPS_KEY> is provided.

To mention in my workflow I've just passed local.properties content from GitHub action secret storage in my workflow.yml like that:

- name: Provide Local properties
  env:
    LOCAL_PROP: ${{ secrets.LOCAL_PROP }}
  run: echo $LOCAL_PROP > ./android/local.properties

When I explicitly added the default option in my app/build.gradle:

secrets {
    defaultPropertiesFileName = 'local.properties'
}

It finally started working! 😎 To conclude I think it should be mentioned somewhere in the documentation that the defaultPropertiesFileName param might be required in some applications.

arriolac commented 2 years ago

The example default properties file is a good reference: https://github.com/google/secrets-gradle-plugin/blob/main/secrets.defaults.properties The purpose is to set default values (doesn't have to be the actual values) so that the repo compiles in different environments like in CI/CD. We can make explicit mention in the README that that's what it is for.

KonradKarimi commented 2 years ago

Sounds great! That's what I presumed - to mention that in README. It's always better to be more verbose than force users to search for answers. Thanks!

arriolac commented 2 years ago

Addressed in 02bb062042610193e54f65498871ec9bcd55f455

AlixH commented 1 year ago

Hello, Could you show where to put the secrets block inside the build.gradle ? If I put it at the root, I am getting "Could not find method secrets()"