Skip to content

Commit

Permalink
more verbose readme
Browse files Browse the repository at this point in the history
  • Loading branch information
barrownicholas committed Jun 14, 2024
1 parent cce527e commit 717546d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [CLI Utility] Google Play App Version Code

Retrieve the latest (or next) version code for a Google Play App. Useful for automating build scripts.
Retrieve the latest (or next) [versionCode](https://developer.android.com/studio/publish/versioning#versioningsettings) for a Google Play App. Useful for automating build scripts.

## Setup

Expand Down Expand Up @@ -40,3 +40,55 @@ sudo apt-get install ./google-app-version.deb
# (Optional) Add the Release to Path (to simply call `google-app-version` from any working directory)
sudo ln -s /usr/local/bin/google-app-version/bin/google-app-version /usr/bin
```

## Usage

- The CLI supports two output modes:

1. the `latest`/current `versionCode` of an application
2. the `next` `versionCode` of an application (just `latest` + 1)

- The contents of the service account's `key.json` file should be passed as an environment variable (useful for CI/CD environments)

### Example

For an application with a production build versionCode of 14:

#### Latest

```shell
JSON=$(cat ~/key.json) && google-app-version latest -f "$JSON" -p com.company.app
# 14
```

#### Next

```shell
JSON=$(cat ~/path/to/key.json) && google-app-version next -f "$JSON" -p com.company.app
# 15
```

### Parameters

- Version (Position 0): `google-app-version <VERSION>`
- `latest`: the latest, currently released `versionCode` of an application
- `google-app-version latest ...`
- `next`: the next-available `versionCode` of an application
- `google-app-version next ...`

### Required Arguments

- JSON File Contents (`-f` / `--file`): the **contents** (not filepath) of a JSON file for the google service account's credentials
- Note: if the file's contents are stored locally, instead of in an environment variable, you can use the following command structure to load the JSON file's contents into an environment variable:
- `MY_JSON_FILE_CONTENTS=$(cat ~/path/to/key.json) && google-app-version -f "$MY_JSON_FILE_CONTENTS" ...`
- Package Name (`-p` / `--package`): the **package** (not application) name
- this is set the after your first release
- in the below example image, (Google Play Console > Home > Apps) the package name is `com.inspiretmstech.mobile`

![](./docs/package-name.png)

### Optional Arguments

- Verbose Output (`-v` / `--verbose`): print debug-level information to the console
- Help (`-h` / `--help`): print full documentation and exit
- Version (`-V` / `--version`): print the CLI version and exit
Binary file added docs/package-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 717546d

Please sign in to comment.