Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
e3baedff
Commit
e3baedff
authored
Mar 25, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gradle tasks for uploading artifacts
parent
588d2d16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
+21
-6
build.gradle.kts
build.gradle.kts
+13
-5
buildSrc/src/main/kotlin/upload/GitToken.kt
buildSrc/src/main/kotlin/upload/GitToken.kt
+8
-1
No files found.
build.gradle.kts
View file @
e3baedff
@
file
:
Suppress
(
"UnstableApiUsage"
)
import
java.time.Duration
import
java.util.*
import
java.util.*
import
kotlin.math.pow
import
kotlin.math.pow
...
@@ -69,6 +72,7 @@ subprojects {
...
@@ -69,6 +72,7 @@ subprojects {
dependsOn
(
shadowJvmJar
)
dependsOn
(
shadowJvmJar
)
doFirst
{
doFirst
{
timeout
.
set
(
Duration
.
ofMinutes
(
10
))
File
(
projectDir
,
"build/libs"
).
walk
()
File
(
projectDir
,
"build/libs"
).
walk
()
.
filter
{
it
.
isFile
}
.
filter
{
it
.
isFile
}
.
onEach
{
println
(
"all files=$it"
)
}
.
onEach
{
println
(
"all files=$it"
)
}
...
@@ -82,11 +86,15 @@ subprojects {
...
@@ -82,11 +86,15 @@ subprojects {
}
}
}
?.
let
{
(
_
,
file
)
->
}
?.
let
{
(
_
,
file
)
->
val
filename
=
file
.
name
val
filename
=
file
.
name
println
(
"filename=$filename"
)
println
(
"Uploading file $filename"
)
upload
.
GitToken
.
upload
(
runCatching
{
file
,
upload
.
GitToken
.
upload
(
"https://api.github.com/repos/mamoe/mirai-repo/contents/shdaow/${project.name}/$filename"
file
,
)
"https://api.github.com/repositories/249670490/contents/shadow/${project.name}/$filename"
)
}.
exceptionOrNull
()
?.
let
{
System
.
err
.
println
(
"Upload failed"
)
}
}
}
}
}
...
...
buildSrc/src/main/kotlin/upload/GitToken.kt
View file @
e3baedff
...
@@ -22,7 +22,14 @@ object GitToken {
...
@@ -22,7 +22,14 @@ object GitToken {
fun
upload
(
file
:
File
,
url
:
String
)
=
runBlocking
{
fun
upload
(
file
:
File
,
url
:
String
)
=
runBlocking
{
HttpClient
(
CIO
)
{
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()}"""
)
{
}.
put
<
String
>(
"""$url?access_token=${getGitToken()}"""
)
{
timeout
{
timeout
{
connectTimeoutMillis
=
600
_000
connectTimeoutMillis
=
600
_000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment