<commit_before><p align="center">
    <img alt="Logo" src="assets/logo.svg" width="25%" />
</p>

<h1 align="center">
    Gradle Play Publisher
</h1>

<p align="center">
    <a href="https://github.com/Triple-T/gradle-play-publisher/actions">
        <img src="https://github.com/Triple-T/gradle-play-publisher/workflows/CI/CD/badge.svg" />
    </a>
    <a href="https://plugins.gradle.org/plugin/com.github.triplet.play">
        <img src="https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/triplet/play/com.github.triplet.play.gradle.plugin/maven-metadata.xml.svg?label=Gradle%20Plugins%20Portal" />
    </a>
</p>

Gradle Play Publisher 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.

## Table of contents

1. [Quickstart guide](#quickstart-guide)
1. [Prerequisites](#prerequisites)
   1. [Initial Play Store upload](#initial-play-store-upload)
   1. [Signing configuration](#signing-configuration)
   1. [Service Account](#service-account)
1. [Basic setup](#basic-setup)
   1. [Installation](#installation)
   1. [Authenticating Gradle Play Publisher](#authenticating-gradle-play-publisher)
1. [Task organization](#task-organization)
1. [Managing artifacts](#managing-artifacts)
   1. [Common configuration](#common-configuration)
   1. [Publishing an App Bundle](#publishing-an-app-bundle)
   1. [Publishing APKs](#publishing-apks)
   1. [Uploading an Internal Sharing artifact](#uploading-an-internal-sharing-artifact)
   1. [Promoting artifacts](#promoting-artifacts)
   1. [Handling version conflicts](#handling-version-conflicts)
1. [Managing Play Store metadata](#managing-play-store-metadata)
   1. [Quickstart](#quickstart)
   1. [Directory structure](#directory-structure)
   1. [Publishing listings](#publishing-listings)
   1. [Publishing in-app products](#publishing-in-app-products)
1. [Working with product flavors](#working-with-product-flavors)
   1. [Disabling publishing](#disabling-publishing)
   1. [Combining artifacts into a single release](#combining-artifacts-into-a-single-release)
   1. [Using multiple Service Accounts](#using-multiple-service-accounts)
1. [Advanced topics](#advanced-topics)
   1. [Using CLI options](#using-cli-options)
   1. [Encrypting Service Account keys](#encrypting-service-account-keys)
   1. [Using HTTPS proxies](#using-https-proxies)

## Quickstart guide

1. Upload the first version of your APK or App Bundle using the
   [Google Play Console](https://play.google.com/apps/publish)
1. [Create a Google Play Service Account](#service-account)
1. [Sign your release builds](https://developer.android.com/studio/publish/app-signing#gradle-sign)
   with a valid `signingConfig`
1. [Add and apply the plugin](#installation)
1. [Authenticate GPP](#authenticating-gradle-play-publisher)

## Prerequisites

### Initial Play Store upload

The first APK or App Bundle needs to be uploaded via the Google Play Console because registering the
app with the Play Store cannot be done using the Play Developer API. For all subsequent uploads and
changes, GPP may be used.

### Signing configuration

To successfully upload apps to the Play Store, they must be signed with your developer key. Make
sure you have
[a valid signing configuration](https://developer.android.com/studio/publish/app-signing#gradle-sign).

### Service Account

To use GPP, you must create a service account with access to the Play Developer API:

1. If you don't already have one, create a GCP project for your app(s)
1. [Link your Google Play developer account](https://play.google.com/apps/publish#ApiAccessPlace)
   to your GCP project
1. Create a
   [service account and key](https://console.cloud.google.com/apis/credentials/serviceaccountkey)
   1. Make sure you're in the GCP project you used above (check the `project` query param in the
      URL)
   1. Select `New service account`
   1. Give it a name and the Project Owner role (don't worry, we'll remove this later)
   1. Leave JSON checked
1. Move the downloaded JSON credentials into your project and
   [tell GPP about it](#authenticating-gradle-play-publisher)
1. Give your service account
   [permissions to publish apps](https://play.google.com/apps/publish#AdminPlace) on your behalf
   1. Click `Invite new user`
   1. Copypaste the service account email (you can find it in the JSON credentials)
   1. Don't touch the roles
   1. Specify which apps the service account should have access to. In this example, GPP has full
      access to testing tracks and app listings, but will be unable to make production releases:
      <img alt="Minimum Service Account permissions" src="assets/min-perms.png" width="66%" />
1. Run `./gradlew bootstrap` or some other GPP task to validate your setup
1. Now that you've successfully created the connection between GCP and Google Play, you can remove
   the Project Owner persmissions
   1. Go to your [IAM settings](https://console.cloud.google.com/iam-admin/iam)
   1. Search for the service account you created
   1. Click the edit icon (found at the end of the row)
   1. In the permission selection panel that opens, click the trash icon to remove the owner role
   1. Click save

## Basic setup
<commit_msg>Add instructions to enable the AndroidPublisher API<commit_after><p align="center">
    <img alt="Logo" src="assets/logo.svg" width="25%" />
</p>

<h1 align="center">
    Gradle Play Publisher
</h1>

<p align="center">
    <a href="https://github.com/Triple-T/gradle-play-publisher/actions">
        <img src="https://github.com/Triple-T/gradle-play-publisher/workflows/CI/CD/badge.svg" />
    </a>
    <a href="https://plugins.gradle.org/plugin/com.github.triplet.play">
        <img src="https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/triplet/play/com.github.triplet.play.gradle.plugin/maven-metadata.xml.svg?label=Gradle%20Plugins%20Portal" />
    </a>
</p>

Gradle Play Publisher 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.

## Table of contents

1. [Quickstart guide](#quickstart-guide)
1. [Prerequisites](#prerequisites)
   1. [Initial Play Store upload](#initial-play-store-upload)
   1. [Signing configuration](#signing-configuration)
   1. [Service Account](#service-account)
1. [Basic setup](#basic-setup)
   1. [Installation](#installation)
   1. [Authenticating Gradle Play Publisher](#authenticating-gradle-play-publisher)
1. [Task organization](#task-organization)
1. [Managing artifacts](#managing-artifacts)
   1. [Common configuration](#common-configuration)
   1. [Publishing an App Bundle](#publishing-an-app-bundle)
   1. [Publishing APKs](#publishing-apks)
   1. [Uploading an Internal Sharing artifact](#uploading-an-internal-sharing-artifact)
   1. [Promoting artifacts](#promoting-artifacts)
   1. [Handling version conflicts](#handling-version-conflicts)
1. [Managing Play Store metadata](#managing-play-store-metadata)
   1. [Quickstart](#quickstart)
   1. [Directory structure](#directory-structure)
   1. [Publishing listings](#publishing-listings)
   1. [Publishing in-app products](#publishing-in-app-products)
1. [Working with product flavors](#working-with-product-flavors)
   1. [Disabling publishing](#disabling-publishing)
   1. [Combining artifacts into a single release](#combining-artifacts-into-a-single-release)
   1. [Using multiple Service Accounts](#using-multiple-service-accounts)
1. [Advanced topics](#advanced-topics)
   1. [Using CLI options](#using-cli-options)
   1. [Encrypting Service Account keys](#encrypting-service-account-keys)
   1. [Using HTTPS proxies](#using-https-proxies)

## Quickstart guide

1. Upload the first version of your APK or App Bundle using the
   [Google Play Console](https://play.google.com/apps/publish)
1. [Create a Google Play Service Account](#service-account)
1. [Sign your release builds](https://developer.android.com/studio/publish/app-signing#gradle-sign)
   with a valid `signingConfig`
1. [Add and apply the plugin](#installation)
1. [Authenticate GPP](#authenticating-gradle-play-publisher)

## Prerequisites

### Initial Play Store upload

The first APK or App Bundle needs to be uploaded via the Google Play Console because registering the
app with the Play Store cannot be done using the Play Developer API. For all subsequent uploads and
changes, GPP may be used.

### Signing configuration

To successfully upload apps to the Play Store, they must be signed with your developer key. Make
sure you have
[a valid signing configuration](https://developer.android.com/studio/publish/app-signing#gradle-sign).

### Service Account

To use GPP, you must create a service account with access to the Play Developer API:

1. If you don't already have one, create a GCP project for your app(s)
1. Enable the
   [AndroidPublisher API](https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com)
   for that GCP project
1. [Link your Google Play developer account](https://play.google.com/apps/publish#ApiAccessPlace)
   to your GCP project
1. Create a
   [service account and key](https://console.cloud.google.com/apis/credentials/serviceaccountkey)
   1. Make sure you're in the GCP project you used above (check the `project` query param in the
      URL)
   1. Select `New service account`
   1. Give it a name and the Project Owner role (don't worry, we'll remove this later)
   1. Leave JSON checked
1. Move the downloaded JSON credentials into your project and
   [tell GPP about it](#authenticating-gradle-play-publisher)
1. Give your service account
   [permissions to publish apps](https://play.google.com/apps/publish#AdminPlace) on your behalf
   1. Click `Invite new user`
   1. Copypaste the service account email (you can find it in the JSON credentials)
   1. Don't touch the roles
   1. Specify which apps the service account should have access to. In this example, GPP has full
      access to testing tracks and app listings, but will be unable to make production releases:
      <img alt="Minimum Service Account permissions" src="assets/min-perms.png" width="66%" />
1. Run `./gradlew bootstrap` or some other GPP task to validate your setup
1. Now that you've successfully created the connection between GCP and Google Play, you can remove
   the Project Owner persmissions
   1. Go to your [IAM settings](https://console.cloud.google.com/iam-admin/iam)
   1. Search for the service account you created
   1. Click the edit icon (found at the end of the row)
   1. In the permission selection panel that opens, click the trash icon to remove the owner role
   1. Click save

## Basic setup

{'fraction_non_alphanumeric': 0.11009344065130909, 'fraction_numerical': 0.012119530021278564, 'mean_word_length': 4.301618440411967, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 23, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1580999', 'n_tokens_mistral': 3328, 'n_tokens_neox': 3094, 'n_words': 1115}