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.12k stars 340 forks source link

Exoprt download url to env var when uploading private arfiact to Internal app sharing #905

Closed pantos27 closed 3 years ago

pantos27 commented 3 years ago

Problem description

Right now when running uploadReleasePrivateBundle or uploadReleasePrivateApk the download url is only written in the log output to the console. This is problematic when running this task in CI machines since it needs to be shared and distributed in an automated process.

Potential solutions/workarounds

Export the download url to an environment variable at the end of the process

SUPERCILEX commented 3 years ago

The API response is actually stored in a JSON file intended for this purpose: build/outputs/internal-sharing/bundle/release/1610051836596.json. (The number is a timestamp, you can just sort descending and pick the first one.) It looks like this:

{
  "certificateFingerprint" : "",
  "downloadUrl" : "",
  "sha256" : ""
}

Does that work? I'd rather not put stuff in an envar because other people might want the other fields and naming is hard. :) Gonna update the docs though.

pantos27 commented 3 years ago

can use a custom var name like GPP_DOWNLOAD_URL

SUPERCILEX commented 3 years ago

Yes, but no. :) Download url to what? And what if people have multiple apps in one build, does the envar get overwritten, or do we have one per app? What if someone wants to upload both an APK and bundle private artifact? Etc etc. Envars are the wrong abstractions for this.

Since it sounds like you want to pass the url to some other program, it should be pretty easy to use jq: https://stedolan.github.io/jq/.