diff --git a/extensions.gradle b/extensions.gradle index a007808ada..2c05cedef2 100644 --- a/extensions.gradle +++ b/extensions.gradle @@ -15,3 +15,13 @@ allprojects { } } } + +tasks.register("getPublishableModules") { + doLast { + rootProject.subprojects.each { project -> + if (project.plugins.hasPlugin('maven-publish')) { + println(":${project.name}") + } + } + } +} diff --git a/gradle/templates/mpp_publish.gradle b/gradle/templates/mpp_publish.gradle index a41327c692..c764d19f0b 100644 --- a/gradle/templates/mpp_publish.gradle +++ b/gradle/templates/mpp_publish.gradle @@ -6,14 +6,17 @@ import java.net.http.HttpResponse apply plugin: 'maven-publish' // This script work based on https://ossrh-staging-api.central.sonatype.com/swagger-ui/#/default/manual_upload_repository // and getting available open repos and just uploading them +def uploadTaskName = "uploadSonatypePublication" +String getBearer() { + def username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') + def password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') + return Base64.getEncoder().encodeToString("$username:$password".getBytes(StandardCharsets.UTF_8)) +} if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - def taskName = "uploadSonatypePublication" - if (rootProject.tasks.names.contains(taskName) == false) { - rootProject.tasks.register(taskName) { + if (rootProject.tasks.names.contains(uploadTaskName) == false) { + rootProject.tasks.register(uploadTaskName) { doLast { - def username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - def password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - def bearer = Base64.getEncoder().encodeToString("$username:$password".getBytes(StandardCharsets.UTF_8)) + def bearer = getBearer() def client = HttpClient.newHttpClient() def request = HttpRequest.newBuilder() @@ -39,7 +42,7 @@ if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != n .build() def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString()) if (uploadResponse.statusCode() != 200) { - throw new IllegalStateException("Faced error of uploading for repo with key $it. Response: $uploadResponse") + println("Faced error of uploading for repo with key $it. Response: $uploadResponse. Check https://central.sonatype.com/publishing/deployments for info or repo with key $it. Response: $uploadResponse") } } } diff --git a/publish_all_script b/publish_all_script new file mode 100755 index 0000000000..a4bfc4ea40 --- /dev/null +++ b/publish_all_script @@ -0,0 +1,25 @@ +#!/bin/bash + +function send_notification() { + echo "$1" +} + +function assert_success() { + "${@}" + local status=${?} + if [ ${status} -ne 0 ]; then + send_notification "### Error ${status} at: ${BASH_LINENO[*]} ###" + exit ${status} + fi +} + +readarray -t projects <<< "`./gradlew getPublishableModules --quiet`" +for project in "${projects[@]}"; do + echo "Start publishing of $project" + assert_success ./gradlew "$project:publishAllPublicationsToSonatypeRepository" --no-parallel --quiet + echo "Complete publishing of $project" + echo "Start uploading of $project" + assert_success ./gradlew uploadSonatypePublication --quiet + echo "Complete uploading of $project" +done + diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index bff95df9ad..1be1e50052 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -364,7 +364,8 @@ public final class dev/inmo/tgbotapi/extensions/api/business/ReadBusinessMessage } public final class dev/inmo/tgbotapi/extensions/api/business/RemoveBusinessAccountProfilePhotoKt { - public static final fun removeBusinessAccountProfilePhoto-spp27rg (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun removeBusinessAccountProfilePhoto-wC12z2M (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static synthetic fun removeBusinessAccountProfilePhoto-wC12z2M$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ljava/lang/String;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/business/SetBusinessAccountBioKt {