Coder Social home page Coder Social logo

vacxe / google-play-cli-kt Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 2.0 307 KB

CLI tool for publish and management application in Google Play Console

License: Apache License 2.0

Kotlin 94.72% Dockerfile 0.66% Shell 4.62%
cli android cicd playstore googleplay tooling distribution

google-play-cli-kt's Introduction

Google play CLI

Transparent CLI tooling for managing Google Play Console.

Table of Contents

This library is transparent CLI wrapper for official Google Play Java Library

Introduction

Previous libs what been used for application deployment contained disadvantages what blocked me from application delivery. As well, all libraries contains internal logic for uploading, but will be nice hot have some more transparent solution.

  • Gradle Triple-T Plugin
    • Integration with build system - Distribution should not be a part of build system. Its blocking us to create a reusable chains on CI. If project is huge, it will create a lot of overhead with evaluation project.
    • Not flexible enough - suitable only for Apk/Bundle upload
  • r0adkll/sign-android-release
    • Not flexible enough - suitable only for Apk/Bundle upload

Advantages of this project

  • Core: Transparent CLI wrapper for Official Google Play Console library
  • Can be installed on host directly as CLI (via brew or binaries) or can be used via Docker or GitHub actions. You are able to test it locally before deployment.
  • Docker: Transparent environment for CLI, as well JQ for easier Json response management in case of custom actions
  • GitHub Action: Transparent wrapper for Docker, with amount of custom templates to simplify day to day actions like upload apk

Installation

Homebrew

brew tap vacxe/tap
brew install vacxe/tap/googleplaycli
ghcr.io/vacxe/google-play-cli:<VERSION>

GitHub Action vacxe/google-play-cli-kt is transparent wrapper over Docker google-play-cli-kt, what contains transparent CLI warapper for Google Play Java Library. It can provide for you possibility to write any custom scripts in depends on you needs or use one of Available templates.

Example of APK uploading template:

- uses: vacxe/google-play-cli-kt@master
  with:
    template: apk-upload
    service-account-json: ${{ secrets.SERVICE_ACCOUNT_JSON }}
    version-code: ${{ github.run_number }}
    package-name: <package name>
    path-to-apk: <path to apk>
    track: internal
    status: draft

How to use CLI directly

  • Before you started you should obtain a serviceAccount.json

    Goto: Google Play Console -> Developer Account -> Api access -> Service Accounts -> CREATE SERVICE ACCOUNT Follow the instruction and grant the access for service account

  • Try basic command

    • google-play-cli --help - list of all commands
    • google-play-cli apk list --config-file service_account.json --package-name <your uploaded apk package name>

Example how to upload apk with step by step explanation:

  • Let configure few environment variables first, what will make our next CLI calls much easier
# If proxy needed
#PLAYSTORE_PROXY=192.168.0.1:3128

# Increase connection timeout
#PLAYSTORE_CONNECTION_TIMEOUT=PT6M

export PLAYSTORE_SERVICE_ACCOUNT_JSON_FILE="/path/to/service_account.json"
# Or set a plain text
#export PLAYSTORE_SERVICE_ACCOUNT_JSON_CONTENT="CONTENT OF JSON"
export APP_PACKAGE_NAME="com.my.package"

Exporting is not required, but if you will not decide to do it you may need to add for each command

  • --config-file "/path/to/service_account.json"
    • or --config-content "CONTENT OF JSON"
  • --package-name "com.my.package"

Tip: On CI you can add service account json file as a secret to environment variable


  • First of all you may need to create edit_id
edit_id=$(google-play-cli edit create)
  • With existing edit_id you can do any modifications in Play Console, let's upload APK
google-play-cli apk upload --edit-id $edit_id --apk "path/to/my.apk"
  • APK been uploaded, we need to assign it to track. Let choice internal track and status will be draft, as well we need to know version code (for example 42)
google-play-cli tracks update --edit-id $edit_id --track "internal" --status "draft" --version-code "42"
  • As a non-required step you can validate your edit at any time
google-play-cli edit validate --edit-id $edit_id
  • And as last step - commit your changes
google-play-cli edit commit --edit-id $edit_id

License


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

google-play-cli-kt's People

Contributors

aafanasev avatar almighty-alpaca avatar malinskiy avatar newnon avatar vacxe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

google-play-cli-kt's Issues

Release 0.2

  • Inappproducts (Done by @aafanasev )
  • Purchases.products
  • Purchases.subscriptions
  • Purchases.voidedpurchases

Error uploading bundles

Hi, I'm trying to use the CLI to upload an AppBundle to the Play Store. I'm using the Docker image with $PWD mounted to /config and get the following error:

$ export PLAYSTORE_SERVICE_ACCOUNT_JSON_FILE=<redacted>
$ export APP_PACKAGE_NAME=<redacted>
$ google-play-cli apk list
{"kind":"androidpublisher#apksListResponse"}
$ edit_id=$(google-play-cli edit create)
$ google-play-cli bundles upload --edit-id $edit_id --bundle app.aab
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
PUT https://www.googleapis.com/upload/androidpublisher/v3/applications/<redacted>/edits/<redacted>/bundles?ackBundleInstallationWarning=false&uploadType=resumable&upload_id=<redacted>
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Media type 'application/vnd.android.package-archive' is not supported. ",
    "reason" : "badRequest"
  } ],
  "message" : "Media type 'application/vnd.android.package-archive' is not supported. ",
  "status" : "INVALID_ARGUMENT"
}
        at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:150)
        at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
        at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:432)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
        at com.github.vacxe.googleplaycli.actions.Bundles$DefaultImpls.bundlesUpload(Bundles.kt:25)
        at com.github.vacxe.googleplaycli.PlayStoreApi.bundlesUpload(PlayStoreApi.kt:14)
        at com.github.vacxe.googleplaycli.Commands$Bundles$Upload.run(Commands.kt:33)
        at com.github.vacxe.googleplaycli.Commands$Bundles$Upload.run(Commands.kt:28)
        at com.github.vacxe.googleplaycli.core.BaseCommand.run(BaseCommand.kt:52)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:154)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:162)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:162)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:252)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:249)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:267)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:290)
        at com.github.vacxe.googleplaycli.PlayStoreCliKt.main(PlayStoreCli.kt:89)

Is there any workaround for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.