Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.1k stars 340 forks source link

Specify ENV name for multi project environments #996

Closed bpappin closed 3 years ago

bpappin commented 3 years ago

Problem description

When working on multiple projects with multiple play accounts, the singular ANDROID_PUBLISHER_CREDENTIALS env variable gets in the way.

Potential solutions/workarounds

Add the ability in the config to specify the environment variable name to look for. e.g. ANDROID_PUBLISHER_CREDENTIALS_PROJ1="my key" ANDROID_PUBLISHER_CREDENTIALS_PROJ2="my other key"

Additional context

This would allow multiple keys without having to jump through config hoops to get the right key in the right place, for the right product. It would also mean that you could do this without breaking current builds, since the default unspecified key would remain the old name.

SUPERCILEX commented 3 years ago

I'm not sure I'll ever want to do this: the problem is that people will eventually also ask for support to have an envar per play config and everything will get messy really fast.

For example, how do we determine the PROJ1 name? Whatever mechanism we choose to generate the envar name, it will be a pain to debug what went wrong (when something inevitable does) because people won't have an easy way to check the name we're searching for.

It will also become incredibly difficult to understand the fallback hierarchy: what happens when you have an envar for a specific build type and credentials specified in a play config for a specific product flavor. The product flavor is supposed to take priority over the build type, but the credentials for the build type were specified in an envar which is supposed to take priority over any gradle config. Again, we can just pick some sort of behavior and document it, but I think it's better if people write a bit of extra code that they understand than use some complicated envar system they're fuzzy on.


In general, if you have a complicated build setup for your project, I feel like it should be pretty easy to have a script do something like echo $FOO > ci-creds-proj1.json and then make sure ci-creds-*.json is in your .gitignore. You can then use ci-creds-xxx.json in your Gradle script and use whatever logic you need to get the right credentials in the right places.

Am I not seeing something that makes this more complicated?

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.