Skip to content

Commit

Permalink
Merge pull request #61 from cianru/snapshot-1.5.0
Browse files Browse the repository at this point in the history
Snapshot 1.5.0
  • Loading branch information
cosic authored Oct 19, 2024
2 parents 64b57d5 + 7cd7a95 commit 5919c9f
Show file tree
Hide file tree
Showing 42 changed files with 751 additions and 627 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 1.5.0

##### Add
* [issue#58] Add new `publishSocketTimeoutInSeconds` parameter to change the socket timeout for publish requests in seconds.
* [issue#59] Add new `credentials` parameter to provide credentials as a base64 encoded string.

##### Breaking Changes
* Remove support of Sonatype. It means that you can't use the plugin from Maven Central. You must to use the Gradle Portal.
To do this, you need to add the following code to your `settings.gradle.kts`:
```kotlin
pluginManagement {
repositories {
gradlePluginPortal()
}
}
```
* Change classpath dependency from `ru.cian:huawei-publish-gradle-plugin:<VERSION>` to `ru.cian.huawei-plugin:plugin:<VERSION>`.
* Remove support of `clientId` and `clientSecret` CLI params. Use `credentials` or `credentialsPath` params instead.

# 1.4.2

##### Add
Expand All @@ -6,7 +25,7 @@
##### Fix
* Fix correct mustRunAfter publish task for `assemble*` and `bundle*` tasks for Gradle 8.

##### Breaking changes
##### Breaking Changes

Changed `releaseNotes` configuration block. Instead of
```
Expand Down
165 changes: 81 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
Huawei AppGallery Publishing Gradle Plugin
</h1>

[![Maven Central](https://img.shields.io/maven-central/v/ru.cian/huawei-publish-gradle-plugin.svg)](https://search.maven.org/search?q=a:huawei-publish-gradle-plugin)
<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" />
<img src="https://img.shields.io/maven-metadata/v.svg?label=Gradle%20Plugins%20Portal&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fm2%2Fru%2Fcian%2Fhuawei-publish-gradle-plugin%2Fru.cian.huawei-publish-gradle-plugin.gradle.plugin%2Fmaven-metadata.xml" />
[![License](https://img.shields.io/github/license/srs/gradle-node-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)

The plugin allows to publish the android release build files (`*.apk` and `*.aab`) to the Huawei AppGallery by use official [Huawei Publish API (v2)](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agcapi-appid-list_v2)
The plugin allows to publish the android release build files (`*.apk` and `*.aab`) to the Huawei AppGallery by use official [Huawei Publish API (v2)](https://developer.huawei.com/consumer/en/doc/AppGallery-connect-References/agcapi-obtain_token-0000001158365043)

:construction: _That's unofficial plugin. We did it for himself and share it for you._
:construction: _That's unofficial plugin. We made it for ourselves and are sharing it for you._

# Table of contents
<!-- TOC -->
Expand All @@ -23,7 +22,7 @@ The plugin allows to publish the android release build files (`*.apk` and `*.aab
- [Adding the plugin to your project](#adding-the-plugin-to-your-project)
- [Using the Gradle plugin DSL](#using-the-gradle-plugin-dsl)
- [Using the `apply` method](#using-the-apply-method)
- [Quickstart Plugin Configuration](#quickstart-plugin-configuration)
- [Quick Start Plugin Configuration](#quick-start-plugin-configuration)
- [Full Plugin Configuration](#full-plugin-configuration)
- [Plugin usage](#plugin-usage)
- [CLI Plugin Configuration](#cli-plugin-configuration)
Expand Down Expand Up @@ -79,80 +78,26 @@ plugins {
}
```

<details>
<summary>Snapshot builds are also available</summary>
___

You'll need to add the Sonatype snapshots repository.
Look for the actual version of the snapshot in the name of the opened `snapshot-<VERSION>` repository branch.

in `./settings.gradle`

```kotlin
pluginManagement {

resolutionStrategy {
eachPlugin {
if(requested.id.namespace == "ru.cian") {
useModule("ru.cian:huawei-publish-gradle-plugin:<SNAPSHOT-VERSION>")
}
}
}

plugins {
id("ru.cian.huawei-publish-gradle-plugin") version huaweiPublish apply false
}

repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
}
```
___
</details>

## Using the `apply` method

```groovy
buildscript {
repositories {
mavenCentral() // or gradlePluginPortal()
}
dependencies {
classpath "ru.cian:huawei-publish-gradle-plugin:<VERSION>"
}
}
apply plugin: 'com.android.application'
apply plugin: 'ru.cian.huawei-publish-gradle-plugin'
```
<details>
<summary>Snapshot builds are also available</summary>
___

You'll need to add the Sonatype snapshots repository.
Look for the actual version of the snapshot in the name of the opened `snapshot-<VERSION>` repository branch.

```kotlin
buildscript {
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
gradlePluginPortal()
}
dependencies {
classpath "ru.cian:huawei-publish-gradle-plugin:<VERSION>-SNAPSHOT"
classpath "ru.cian.huawei-plugin:plugin:<PLUGIN_VERSION>"
}
}
apply plugin: 'com.android.application'
apply plugin: 'ru.cian.huawei-publish-gradle-plugin'
```
___

</details>
## Quick Start Plugin Configuration

## Quickstart Plugin Configuration
Before using the plugin you should get `client_id` and `client_secret` from [AppGallery Connect API Getting Started](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agcapi-getstarted).

Minimal configuration for plugin usage:

Expand All @@ -164,19 +109,21 @@ huaweiPublish {
instances {
create("release") {
/**
* Path to json file with AppGallery credentials params (`client_id` and `client_secret`).
* Description: The AppGallery credentials params (`client_id` and `client_secret`) in json format witch encoded to Base64.
* How to get credentials see [AppGallery Connect API Getting Started](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agcapi-getstarted).
* Plugin credential json example:
*
* Credential json example:
* {
* "client_id": "<CLIENT_ID>",
* "client_secret": "<CLIENT_SECRET>"
* }
* Base64 encoded value example: "ewogICAgImNsaWVudF9pZCI6ICI8Q0xJRU5UX0lEPiIsCiAgICAiY2xpZW50X3NlY3JldCI6ICI8Q0xJRU5UX1NFQ1JFVD4iCn0="
*
* Type: String (Optional)
* Default value: `null` (but plugin wait that you provide credentials by CLI params)
* CLI: `--credentialsPath`
*/
credentialsPath = "$rootDir/huawei-credentials-release.json"
* CLI: `--credentials`
*/
credentials = "<BASE64_ENCODED_CREDENTIALS>"

/**
* 'apk' or 'aab' for corresponding build format.
Expand Down Expand Up @@ -216,8 +163,28 @@ huaweiPublish {
instances {
create("release") {
/**
* Path to json file with AppGallery credentials params (`client_id` and `client_secret`).
* Description: The AppGallery credentials params (`client_id` and `client_secret`) in json format witch encoded to Base64.
* How to get credentials see [AppGallery Connect API Getting Started](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agcapi-getstarted).
* High priority than `credentialsPath` parameter.
*
* Credential json example:
* {
* "client_id": "<CLIENT_ID>",
* "client_secret": "<CLIENT_SECRET>"
* }
* Base64 encoded value example: "ewogICAgImNsaWVudF9pZCI6ICI8Q0xJRU5UX0lEPiIsCiAgICAiY2xpZW50X3NlY3JldCI6ICI8Q0xJRU5UX1NFQ1JFVD4iCn0="
*
* Type: String (Optional)
* Default value: `null` (but plugin wait that you provide credentials by CLI params)
* CLI: `--credentials`
*/
credentials = "<BASE64_ENCODED_CREDENTIALS>"

/**
* Description: Path to json file with AppGallery credentials params (`client_id` and `client_secret`).
* How to get credentials see [AppGallery Connect API Getting Started](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agcapi-getstarted).
* Low priority than `credentials` parameter.
*
* Plugin credential json example:
* {
* "client_id": "<CLIENT_ID>",
Expand All @@ -232,22 +199,47 @@ huaweiPublish {

/**
* Deploy type. Available values:
* '`publish`' to deploy and submit build on users;
* '`draft`' to deploy and save as draft without submit on users;
* '`upload-only`' to deploy without draft saving and submit on users;
* Type String (Optional)
* Default value: `publish`
* CLI `--deployType`
* Gradle: available values:
* ru.cian.huawei.publish.DeployType.PUBLISH
* ru.cian.huawei.publish.DeployType.UPLOAD_ONLY
* ru.cian.huawei.publish.DeployType.DRAFT
* CLI: `--deployType`, available values:
* 'publish' to deploy and submit build on users;
* 'draft' to deploy and save as draft without submit on users;
* 'upload-only' to deploy without draft saving and submit on users;
*/
deployType = ru.cian.huawei.publish.DeployType.PUBLISH

/**
* 'apk' or 'aab' for corresponding build format.
* Description: Build file format.
* Type: String (Optional)
* Default value: `apk`
* CLI: `--buildFormat`
* Gradle: available values:
* ru.cian.huawei.publish.BuildFormat.APK
* ru.cian.huawei.publish.BuildFormat.AAB
* CLI: `--buildFormat`, available values:
* 'apk' – for APK build format;
* 'aab' – for AAB build format.
*/
buildFormat = ru.cian.huawei.publish.BuildFormat.APK

/**
* Description: By default, the plugin searches for the assembly file at the standard file path. Use param to change file path.
* Type: String (Optional)
* Default value: null
* CLI: `--buildFile`
*/
buildFile = "${buildDir}/app/outputs/apk/release/app-release.apk"

/**
* The socket timeout for publish requests in seconds.
* Type: Long (Optional)
* Default value: `60` // (1min)
* CLI: `--publishSocketTimeoutInSeconds`
*/
publishSocketTimeoutInSeconds = 60

/**
* API use chunks to upload the build file. So after last file part server needs some time to join and check whole file.
Expand Down Expand Up @@ -379,9 +371,12 @@ huaweiPublish {
huaweiPublish {
instances {
release {
credentialsPath = "$rootDir/huawei-credentials-release.json"
credentials = "<BASE64_ENCODED_CREDENTIALS>" // High priority than `credentialsPath`;
credentialsPath = "$rootDir/huawei-credentials-release.json" // Low priority than `credentials`;
deployType = "publish"
buildFormat = "apk"
buildFile = "${buildDir}/app/outputs/apk/release/app-release.apk"
publishSocketTimeoutInSeconds = 60
publishTimeoutMs = 600_000
publishPeriodMs = 15_000
releaseTime = "2025-10-21T06:00:00+0300"
Expand Down Expand Up @@ -454,9 +449,12 @@ CLI params are more priority than gradle configuration params.

```bash
./gradlew assembleRelease publishHuaweiAppGalleryRelease \
--credentialsPath="/sample-kotlin/huawei-credentials.json" \
--credentials = "<BASE64_ENCODED_CREDENTIALS>" \ # High priority than `credentialsPath`;
--credentialsPath="./sample-kotlin/huawei-credentials.json" \ # Low priority than `credentials`;
--deployType=publish \
--buildFormat=apk \
--buildFile="./app/outputs/apk/release/app-release.apk"
--publishSocketTimeoutInSeconds=60 \
--publishTimeoutMs=600000 \
--publishPeriodMs=15000 \
--releaseTime="2025-10-21T06:00:00+0300" \
Expand All @@ -479,7 +477,7 @@ From gradle build script:
huaweiPublish {
instances {
release {
credentialsPath = "$rootDir/sample1/huawei-credentials.json"
credentials = "<BASE64_ENCODED_CREDENTIALS>"
deployType = "draft"
}
}
Expand All @@ -490,7 +488,7 @@ or execute from command line:

```bash
./gradlew assembleRelease publishHuaweiAppGalleryRelease \
--credentialsPath="$rootDir/sample1/huawei-credentials.json" \
--credentials = "<BASE64_ENCODED_CREDENTIALS>" \
--deployType=draft
```

Expand All @@ -506,7 +504,7 @@ From gradle build script:
huaweiPublish {
instances {
release {
credentialsPath = "$rootDir/sample1/huawei-credentials.json"
credentials = "<BASE64_ENCODED_CREDENTIALS>"
buildFormat = "aab"
}
}
Expand All @@ -516,7 +514,7 @@ or execute from command line:

```bash
./gradlew assembleRelease publishHuaweiAppGalleryRelease \
--credentialsPath="$rootDir/sample1/huawei-credentials.json" \
--credentials = "<BASE64_ENCODED_CREDENTIALS>" \
--buildFormat=aab
```

Expand Down Expand Up @@ -547,7 +545,7 @@ From gradle build script:
huaweiPublish {
instances {
release {
credentialsPath = "$rootDir/sample1/huawei-credentials.json"
credentials = "<BASE64_ENCODED_CREDENTIALS>"
releasePhase {
startTime = "2020-11-13T08:01:02+0300"
endTime = "2020-11-20T15:30:00+0300"
Expand All @@ -562,8 +560,7 @@ or execute from command line:

```bash
./gradlew assembleRelease publishHuaweiAppGalleryRelease \
--clientId=<CLIENT_ID> \
--clientSecret=<CLIENT_SECRET> \
--credentials = "<BASE64_ENCODED_CREDENTIALS>" \
--releasePhaseStartTime=2020-11-13T08:01:02+0300 \
--releasePhaseEndTime=2020-11-20T15:30:00+0300 \
--releasePhasePercent=10.0
Expand Down
19 changes: 7 additions & 12 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,18 @@ elaborate and requires a good deal of local configuration. This guide should wa
you through it. It won't do anyone outside of KeepSafe any good, but the workflow
is representative of just about any project deploying via Sonatype.

We currently deploy to both Maven Central (via Sonatype's OSS Nexus instance) and to
plugins.gradle.org.
We currently deploy to plugins.gradle.org.

## Prerequisites

1. A *published* GPG code-signing key
2. A Sonatype Nexus OSS account with permission to publish in ru.cian
3. A plugins.gradle.org account with permission to publish in ru.cian
4. Permission to push directly to https://github.com/cianru/huawei-publish-gradle-plugin
1. A plugins.gradle.org account with permission to publish in ru.cian
1. Permission to push directly to https://github.com/cianru/huawei-publish-gradle-plugin

## Contents page

1. [Setup](docs/releasing/01-setup.md)
2. [Prepare Release Commit](docs/releasing/02-prepare-release-commit.md)
3. [Pushing a SNAPSHOT build to local repository](docs/releasing/03-publish-a-snapshot-to-local-repository.md)
4. [Pushing a SNAPSHOT build to Sonatype](docs/releasing/04-publish-a-snapshot-to-sonatype.md)
5. [Pushing a release build to Sonatype](docs/releasing/05-publish-a-release-build-to-sonatype.md)
6. [Pushing a release build to Bintray (DEPRECATED)](docs/releasing/06-publish-a-release-build-to-bintray.md)
7. [Pushing a release build to Gradle Plugin Portal](docs/releasing/07-publish-a-release-build-to-gradle-plugin-portal.md)
8. [Prepare Next Snapshot Version Commit](docs/releasing/08-prepare-next-snapshot-version-commit.md)
1. [Prepare Release Commit](docs/releasing/02-prepare-release-commit.md)
1. [Pushing a build to local repository](docs/releasing/03-publish-to-local-repository)
1. [Pushing a release build to Gradle Plugin Portal](docs/releasing/07-publish-a-release-build-to-gradle-plugin-portal.md)
1. [Prepare Next Alpha Version Commit](docs/releasing/08-prepare-alpha-version-commit)
13 changes: 0 additions & 13 deletions docs/releasing/01-setup.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
## Setup

1. Add your GPG key to your github profile - this is required
for github to know that your commits and tags are "verified".
1. Configure your code-signing key in ~/.gradle.properties:
```gradle
signing.keyId=<key ID of your GPG signing key>
signing.password=<your key's passphrase>
signing.secretKeyRingFile=/path/to/your/secring.gpg
```
1. Configure your Sonatype credentials in ~/.gradle/gradle.properties:
```gradle
SONATYPE_NEXUS_USERNAME=<nexus username>
SONATYPE_NEXUS_PASSWORD=<nexus password>
```
1. Configure git with your codesigning key; make sure it's the same as the one
you use to sign binaries (i.e. it's the same one you adaded to gradle.properties):
```bash
Expand Down
Loading

0 comments on commit 5919c9f

Please sign in to comment.