Skip to content

Commit

Permalink
Merge pull request #10 from cianru/snapshot-0.4.0
Browse files Browse the repository at this point in the history
Snapshot 0.4.0
  • Loading branch information
cosic authored Jul 18, 2024
2 parents f88866c + ce1796c commit fe4b377
Show file tree
Hide file tree
Showing 26 changed files with 71 additions and 109 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
# 0.4.0

##### Breaking Changes
* [issue#8](https://github.com/cianru/rustore-publish-gradle-plugin/issues/8) The companyId in POST /public/auth/ will be deprecated by new documentation.
According to [message](https://t.me/rustoredev/476) the `companyId` parameter of `POST /public/auth/` request is deprecated from 30 Jule 2024. Need to use `keyId` instead of.

You need to get `keyId` by [instruction](https://www.rustore.ru/help/work-with-rustore-api/api-authorization-token/) and change the credentials file from:
```json
{
"company_id": "<COMPANY_ID>",
"client_secret": "<CLIENT_SECRET>"
}
```
to:
```json
{
"key_id": "<KEY_ID>",
"client_secret": "<CLIENT_SECRET>"
}
```

# 0.3.2

##### Add
* [issue#5](https://github.com/cianru/rustore-publish-gradle-plugin/issues/5) Support of serviceType plugin param.


# 0.3.1

##### Add
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</h1>
</p>

![Version](https://img.shields.io/badge/GradlePortal-0.3.2-green.svg)
![Version](https://img.shields.io/badge/GradlePortal-0.4.0-green.svg)
![Version](https://img.shields.io/badge/Gradle-8.*-pink.svg)
[![License](https://img.shields.io/github/license/srs/gradle-node-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)

Expand Down Expand Up @@ -143,7 +143,7 @@ buildscript {
}
dependencies {
classpath "ru.cian.rustore-plugin:rustore-publish-gradle-plugin::<VERSION>-SNAPSHOT"
classpath "ru.cian.rustore-plugin:rustore-publish-gradle-plugin:<VERSION>-SNAPSHOT"
}
}
Expand All @@ -161,11 +161,11 @@ rustorePublish {
instances {
create("release") {
/**
* Path to json file with RuStore credentials params (`company_id` and `client_secret`).
* How to get credentials see [[RU] Rustore API Getting Started](https://help.rustore.ru/rustore/for_developers/work_with_RuStore_API/authorization_rustore_api_1).
* Path to json file with RuStore credentials params (`key_id` and `client_secret`).
* How to get credentials see [[RU] Rustore API Getting Started](https://www.rustore.ru/help/work-with-rustore-api/api-authorization-process/).
* Plugin credential json example:
* {
* "company_id": "<COMPANY_ID>",
* "key_id": "<KEY_ID>",
* "client_secret": "<CLIENT_SECRET>"
* }
*
Expand Down Expand Up @@ -212,11 +212,11 @@ rustorePublish {
instances {
create("release") {
/**
* Path to json file with RuStore credentials params (`company_id` and `client_secret`).
* How to get credentials see [[RU] Rustore API Getting Started](https://help.rustore.ru/rustore/for_developers/work_with_RuStore_API/authorization_rustore_api_1).
* Path to json file with RuStore credentials params (`key_id` and `client_secret`).
* How to get credentials see [[RU] Rustore API Getting Started](https://www.rustore.ru/help/work-with-rustore-api/api-authorization-process/).
* Plugin credential json example:
* {
* "company_id": "<COMPANY_ID>",
* "key_id": "<KEY_ID>",
* "client_secret": "<CLIENT_SECRET>"
* }
*
Expand Down
7 changes: 3 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ plugins.gradle.org.
2. [Pushing a SNAPSHOT build to local repository](docs/releasing/02-publish-a-snapshot-to-local-repository.md)
3. [Pushing a SNAPSHOT build to Sonatype](docs/releasing/03-publish-a-snapshot-to-sonatype.md)
4. [Pushing a release build to Sonatype](docs/releasing/04-publish-a-release-build-to-sonatype.md)
5. [Pushing a release build to Bintray (DEPRECATED)](docs/releasing/05-publish-a-release-build-to-bintray.md)
6. [Pushing a release build to Gradle Plugin Portal](docs/releasing/06-publish-a-release-build-to-gradle-plugin-portal.md)
7. [Prepare Release Commit](docs/releasing/07-prepare-release-commit.md)
8. [Prepare Next Snapshot Version Commit](docs/releasing/08-prepare-next-snapshot-version-commit.md)
5. [Pushing a release build to Gradle Plugin Portal](docs/releasing/06-publish-a-release-build-to-gradle-plugin-portal.md)
6. [Prepare Release Commit](docs/releasing/07-prepare-release-commit.md)
7. [Prepare Next Snapshot Version Commit](docs/releasing/08-prepare-next-snapshot-version-commit.md)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
```
3. Publish to local repository
```bash
./gradlew publishToMavenLocal
./gradlew :plugin:publishToMavenLocal
```
4. Remove local repository to apply remote build repository
```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/releasing/03-publish-a-snapshot-to-sonatype.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
```
3. Upload binaries to Sonatype:
```bash
./gradlew publishRustoreToMavenRepository
./gradlew :plugin:publishRustorePublicationToMavenRepository
```
4. Check snapshot: [nexus-search](https://oss.sonatype.org/#nexus-search;quick~ru.cian)
4 changes: 2 additions & 2 deletions docs/releasing/04-publish-a-release-build-to-sonatype.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
```
1. Upload binaries to Sonatype:
```bash
./gradlew publishRustorePublicationToMavenRepository
./gradlew :plugin:publishRustorePublicationToMavenRepository
```
1. Check uploaded files and version Sonatype site: [search.maven.org](https://search.maven.org/search?q=ru.cian)
and [repo1.maven.org](https://repo1.maven.org/maven2/ru/cian/rustore-publish-gradle-plugin/)
and [repo1.maven.org](https://repo1.maven.org/maven2/ru/cian/rustore-plugin/rustore-publish-gradle-plugin/)
1. Go to [oss.sonatype.org](https://oss.sonatype.org), log in with your credentials
1. Click "Staging Repositories"
1. Find the "ru.cian" repo, usually at the bottom of the list
Expand Down
15 changes: 0 additions & 15 deletions docs/releasing/05-publish-a-release-build-to-bintray.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
```
1. Upload binaries to Gradle's plugin portal:
```bash
./gradlew publishPlugins
./gradlew :plugin:publishPlugins
```
1. Check uploaded plugin and version at [Gradle Plugin Portal site](https://plugins.gradle.org/plugin/ru.cian.rustore-publish-gradle-plugin).
9 changes: 4 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ targetSdkVersion = "33"
minSdkVersion = "21"

jvm = "17"
kotlin = "1.9.21"
kotlin = "1.9.23"
detekt = "1.23.4"
junitJupiter = "5.9.3"
androidGradlePlugin = "8.0.2"
sampleRustorePlugin = "0.3.2-SNAPSHOT"
sampleRustorePlugin = "0.4.0-SNAPSHOT"

[libraries]
appcompat = "androidx.appcompat:appcompat:1.6.1"
Expand All @@ -36,10 +36,9 @@ test-junitJupiterEngine = { group = "org.junit.jupiter", name = "junit-jupiter-e
test-junitJupiterParams = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "junitJupiter" }

[plugins]
dokka = { id = "org.jetbrains.dokka", version = "1.8.10" }
bintray = { id = "com.jfrog.bintray", version = "1.8.5" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.10" }
pluginPublish = { id = "com.gradle.plugin-publish", version = "0.15.0" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
benManesVersions = { id = "com.github.ben-manes.versions", version = "0.46.0" }
benManesVersions = { id = "com.github.ben-manes.versions", version = "0.47.0" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
gradleDoctor = { id = "com.osacky.doctor", version = "0.9.1" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
2 changes: 0 additions & 2 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ plugins {
`signing`
alias(libs.plugins.detekt)
alias(libs.plugins.pluginPublish)
alias(libs.plugins.bintray)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinJvm)
}

apply(from = "$projectDir/config/maven-publish.gradle")
apply(from = "$projectDir/config/bintray-publish.gradle")
apply(from = "$projectDir/config/gradle-portal.gradle")

detekt {
Expand Down
38 changes: 0 additions & 38 deletions plugin/config/bintray-publish.gradle

This file was deleted.

5 changes: 1 addition & 4 deletions plugin/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android.enableJetifier=true
####################################################################################################

GROUP_ID=ru.cian.rustore-plugin
VERSION_NAME=0.3.2
VERSION_NAME=0.4.0
IS_SNAPSHOT=true

POM_ARTIFACT_ID=rustore-publish-gradle-plugin
Expand All @@ -34,9 +34,6 @@ POM_DEVELOPER_NAME=CIAN, Inc.
POM_DEVELOPER_EMAIL=[email protected]
POM_DEVELOPER_CITE=www.cian.ru

BINTRAY_REPO=ru.cian
BINTRAY_PKG=rustore-publish-gradle-plugin

GRADLE_PORTAL_URL=https://github.com/cianru/rustore-publish-gradle-plugin
GRADLE_PORTAL_SCM_URL=https://github.com/cianru/rustore-publish-gradle-plugin.git
GRADLE_PORTAL_ARTIFACT_ID=ru.cian.rustore-publish-gradle-plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ internal data class ReleasePhaseConfig(
)

internal data class Credentials(
var companyId: String,
var keyId: String,
var clientSecret: String,
)

internal data class InputPluginCliParam(
val deployType: DeployType? = null,
val credentialsPath: String? = null,
val companyId: String? = null,
val keyId: String? = null,
val clientSecret: String? = null,
val mobileServicesType: MobileServicesType? = null,
val buildFormat: BuildFormat? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ open class RustorePublishTask

@get:Internal
@set:Option(
option = "companyId",
description = "'company_id' param from AppGallery credentials. " +
option = "keyId",
description = "'keyId' param from AppGallery credentials. " +
"The key more priority than value from 'credentialsPath'"
)
var companyId: String? = null
var keyId: String? = null

@get:Internal
@set:Option(
Expand Down Expand Up @@ -139,7 +139,7 @@ open class RustorePublishTask
val cli = InputPluginCliParam(
deployType = deployType,
credentialsPath = credentialsPath,
companyId = companyId,
keyId = keyId,
clientSecret = clientSecret,
mobileServicesType = mobileServicesType,
buildFormat = buildFormat,
Expand Down Expand Up @@ -169,13 +169,13 @@ open class RustorePublishTask
logger.v("2/6. Create signature")
val datetimeFormatPattern = DateTimeFormatter.ofPattern(DATETIME_FORMAT_ISO8601)
val timestamp = ZonedDateTime.now().format(datetimeFormatPattern)
val salt = "${config.credentials.companyId}$timestamp"
val salt = "${config.credentials.keyId}$timestamp"
val signatureTools: SignatureTools = if (apiStub != true) SignatureToolsImpl() else MockSignatureTools()
val signature = signatureTools.signData(salt, config.credentials.clientSecret)

logger.v("3/6. Get Access Token")
val token = rustoreService.getToken(
companyId = config.credentials.companyId,
keyId = config.credentials.keyId,
timestamp = timestamp,
signature = signature,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ru.cian.rustore.publish.models
import com.google.gson.annotations.SerializedName

internal data class Credential(
@SerializedName("company_id")
val companyId: String?,
@SerializedName("key_id")
val keyId: String?,
@SerializedName("client_secret")
val clientSecret: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ru.cian.rustore.publish.models.request
import com.google.gson.annotations.SerializedName

internal data class AccessTokenRustoreRequest(
@SerializedName("companyId")
val companyId: String,
@SerializedName("keyId")
val keyId: String,
@SerializedName("timestamp")
val timestamp: String,
@SerializedName("signature")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.io.File
@SuppressWarnings("StringLiteralDuplication", "TooManyFunctions")
internal class MockRustoreService : RustoreService {

override fun getToken(companyId: String, timestamp: String, signature: String): String {
override fun getToken(keyId: String, timestamp: String, signature: String): String {
return "MockToken"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.io.File
internal interface RustoreService {

fun getToken(
companyId: String,
keyId: String,
timestamp: String,
signature: String,
): String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ internal class RustoreServiceImpl constructor(
private val httpClient = HttpClientHelper(logger)

override fun getToken(
companyId: String,
keyId: String,
timestamp: String,
signature: String,
): String {

val bodyRequest = AccessTokenRustoreRequest(
companyId = companyId,
keyId = keyId,
timestamp = timestamp,
signature = signature,
)
Expand All @@ -41,7 +41,7 @@ internal class RustoreServiceImpl constructor(
$DOMAIN_URL/public/auth/ \
--header 'Content-Type: application/json' \
--data-raw '{
"companyId": "$companyId",
"keyId": "$keyId",
"timestamp": "$timestamp",
"signature": "$signature"
}'
Expand Down
Loading

0 comments on commit fe4b377

Please sign in to comment.