mirror of
https://github.com/mamoe/mirai.git
synced 2024-12-28 09:30:10 +08:00
Gradle tasks for uploading artifacts
This commit is contained in:
parent
588d2d16ca
commit
e3baedfff2
@ -1,3 +1,6 @@
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import java.time.Duration
|
||||
import java.util.*
|
||||
import kotlin.math.pow
|
||||
|
||||
@ -69,6 +72,7 @@ subprojects {
|
||||
dependsOn(shadowJvmJar)
|
||||
|
||||
doFirst {
|
||||
timeout.set(Duration.ofMinutes(10))
|
||||
File(projectDir, "build/libs").walk()
|
||||
.filter { it.isFile }
|
||||
.onEach { println("all files=$it") }
|
||||
@ -82,11 +86,15 @@ subprojects {
|
||||
}
|
||||
}?.let { (_, file) ->
|
||||
val filename = file.name
|
||||
println("filename=$filename")
|
||||
upload.GitToken.upload(
|
||||
file,
|
||||
"https://api.github.com/repos/mamoe/mirai-repo/contents/shdaow/${project.name}/$filename"
|
||||
)
|
||||
println("Uploading file $filename")
|
||||
runCatching {
|
||||
upload.GitToken.upload(
|
||||
file,
|
||||
"https://api.github.com/repositories/249670490/contents/shadow/${project.name}/$filename"
|
||||
)
|
||||
}.exceptionOrNull()?.let {
|
||||
System.err.println("Upload failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,14 @@ object GitToken {
|
||||
|
||||
fun upload(file: File, url: String) = runBlocking {
|
||||
HttpClient(CIO) {
|
||||
install(HttpTimeout)
|
||||
engine {
|
||||
requestTimeout = 600_000
|
||||
}
|
||||
install(HttpTimeout) {
|
||||
connectTimeoutMillis = 600_000
|
||||
requestTimeoutMillis = 600_000
|
||||
socketTimeoutMillis = 600_000
|
||||
}
|
||||
}.put<String>("""$url?access_token=${getGitToken()}""") {
|
||||
timeout {
|
||||
connectTimeoutMillis = 600_000
|
||||
|
Loading…
Reference in New Issue
Block a user