1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-02 22:59:48 +00:00

update publishing way

This commit is contained in:
2025-05-31 17:04:51 +06:00
parent a9562cc8f9
commit ddb79c0d8d
4 changed files with 47 additions and 8 deletions

View File

@@ -15,3 +15,13 @@ allprojects {
} }
} }
} }
tasks.register("getPublishableModules") {
doLast {
rootProject.subprojects.each { project ->
if (project.plugins.hasPlugin('maven-publish')) {
println(":${project.name}")
}
}
}
}

View File

@@ -6,14 +6,17 @@ import java.net.http.HttpResponse
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
// This script work based on https://ossrh-staging-api.central.sonatype.com/swagger-ui/#/default/manual_upload_repository // 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 // 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)) { 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(uploadTaskName) == false) {
if (rootProject.tasks.names.contains(taskName) == false) { rootProject.tasks.register(uploadTaskName) {
rootProject.tasks.register(taskName) {
doLast { doLast {
def username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') def bearer = getBearer()
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 client = HttpClient.newHttpClient() def client = HttpClient.newHttpClient()
def request = HttpRequest.newBuilder() def request = HttpRequest.newBuilder()
@@ -39,7 +42,7 @@ if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != n
.build() .build()
def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString()) def uploadResponse = client.send(uploadRequest, HttpResponse.BodyHandlers.ofString())
if (uploadResponse.statusCode() != 200) { 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")
} }
} }
} }

25
publish_all_script Executable file
View File

@@ -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

View File

@@ -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 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 { public final class dev/inmo/tgbotapi/extensions/api/business/SetBusinessAccountBioKt {