[supply][action] add download_apk_from_google_play action (and corresponding supply methods) - #21315
Conversation
9c0555b to
01d9661
Compare
Add methods on the Supply client to list and download Universal Generated APKs from the Google Play Console — typically generated and code-signed by Google from the AAB you uploaded e.g. via the `upload_to_play_store`/`supply` action
Very useful when you use [Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756) and thus don't necessary have the signing key to produce the APK yourself. In those cases, you typically only upload an AAB to GPC, then let Google code-sign and generate signed APKs from that AAB.
…` exceptions Because most of the options that are detected as not being used directly by the action are in fact just passed along to Supply::Client.make_from_config
01d9661 to
546df7e
Compare
download_apk_from_google_play action (and corresponding Supply methods)download_apk_from_google_play action (and corresponding supply methods)
|
@joshdholtz Now that you're back from your vacation 😃 May I kindly ask a review of this one? I'd love to be able to finally use it in our automation soon 🙂 |
| expect(subject.class.method_defined?(:list_generatedapks)).to eq(true) | ||
| expect(subject.class.method_defined?(:download_generatedapk)).to eq(true) |
There was a problem hiding this comment.
Yes. That spec tests methods we expect to be defined on the AndroidPublisher::AndroidPublisherService internal client (not to be confused with the Supply::Client).
Those two particular ones that I added there are documented here in the AndroidPublisherService ruby doc:
AndroidPublisher::AndroidPublisherService#list_generatedapksAndroidPublisher::AndroidPublisherService#download_generatedapk
And those are the ones that I call in the Supply::Client corresponding wrapper methods here and here, respectively.
So all that is correct, and consistent with how the rest of the spec and that file is written 🙂
(Plus, that spec/test passes on CI, while it would be red if those were not correct)
There was a problem hiding this comment.
Ah I see. Thanks! I'm much less familiar with the Android code.
There was a problem hiding this comment.
No worries! Took me some time to familiarize myself with the AndroidPublisher API and Supply code and specs as well when I wrote that PR 😅 🙂
Checklist
bundle exec rspecfrom the root directory to see all new and existing tests passbundle exec rubocop -ato ensure the code style is validci/circlecibuilds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)I've updated the documentation if necessary.N/A; actions documentation are auto-generated anywayMotivation and Context
This adds a new
download_apk_from_google_playaction to download the Universal Code-Signed APK generated by Google after you uploaded the AAB.This is especially useful when you use Play App Signing to sign your app, because in those cases you'll typically use the
upload_to_google_playaction to upload a.aabto Google Play Console (GPC), and let Google generate and code-sign the.apkfiles for that.aab(including split APKs for various architectures, but more importantly the Universal one compatible with all devices)In those situations of using "Play App Signing", you can't use
bundletoolto generate the signed.apkfrom the.aabyourself because you don't have the code signing key (only Google has it), so the only option is to download the.apkfrom GPC.And it's useful to get the universal, codesigned APK back because we can use it for running UI tests on it, making sure we run those on the exact APK that will be ultimately shipped to end users (including testing things that rely on code-signing signature checks for security and integrity validation).
Description
Supply::Clientlist_generated_universal_apks(package_name:, version_code:)method onSupply::Clientto be able to call thegeneratedapks.listAPI endpointdownload_generated_universal_apk(generated_universal_apk:, destination:)method onSupply::Clientto be able to call thegeneratedapks.downloadAPI endpointspec/client_spec.rbtestsGeneratedUniversalApkmodel to allow manipulating the result of those methods more easilydownload_universal_apk_from_google_playaction as well as its unit tests (spec)Testing Steps
Run the new Unit Tests: