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
40c22f42
Commit
40c22f42
authored
Apr 11, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add bintray publisher workflow
parent
3f7bba77
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
113 deletions
+136
-113
.github/workflows/bintray.yml
.github/workflows/bintray.yml
+48
-0
.gitignore
.gitignore
+3
-1
buildSrc/src/main/kotlin/upload/Bintray.kt
buildSrc/src/main/kotlin/upload/Bintray.kt
+79
-0
gradle/publish-japt.gradle
gradle/publish-japt.gradle
+0
-104
gradle/publish.gradle
gradle/publish.gradle
+6
-8
No files found.
.github/workflows/bintray.yml
0 → 100644
View file @
40c22f42
# This is a basic workflow to help you get started with Actions
name
:
Bintray Publish
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on
:
release
:
types
:
-
created
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs
:
# This workflow contains a single job called "build"
build
:
runs-on
:
ubuntu-latest
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Set up JDK
1.8
uses
:
actions/setup-java@v1
with
:
java-version
:
1.8
-
name
:
Grant execute permission for gradlew
run
:
chmod +x gradlew
-
name
:
Gradle clean
run
:
./gradlew clean
-
name
:
Gradle build
run
:
./gradlew build
# if test's failed, don't publish
-
name
:
Gradle :mirai-core:bintrayUpload
run
:
./gradlew :mirai-core:bintrayUpload -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
-
name
:
Gradle :mirai-core-qqandroid:bintrayUpload
run
:
./gradlew :mirai-core-qqandroid:bintrayUpload -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
# - name: Upload artifact
# uses: actions/upload-artifact@v1.0.0
# with:
# # Artifact name
# name: mirai-core
# # Directory containing files to upload
# path: "mirai-core/build/libs/mirai-core-*-all.jar"
# - name: Upload artifact
# uses: actions/upload-artifact@v1.0.0
# with:
# # Artifact name
# name: mirai-core-qqandroid-all
# # Directory containing files to upload
# path: "mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar"
.gitignore
View file @
40c22f42
...
@@ -43,4 +43,6 @@ local.properties
...
@@ -43,4 +43,6 @@ local.properties
keys.properties
keys.properties
/plugins/
/plugins/
token.txt
token.txt
\ No newline at end of file
bintray.user.txt
bintray.key.txt
\ No newline at end of file
buildSrc/src/main/kotlin/upload/Bintray.kt
0 → 100644
View file @
40c22f42
package
upload
import
org.gradle.api.Project
import
org.gradle.kotlin.dsl.provideDelegate
import
java.io.File
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
object
Bintray
{
@JvmStatic
fun
getUser
(
project
:
Project
):
String
{
kotlin
.
runCatching
{
@Suppress
(
"UNUSED_VARIABLE"
,
"LocalVariableName"
)
val
bintray_user
:
String
by
project
return
bintray_user
}
System
.
getProperty
(
"bintray_user"
,
null
)
?.
let
{
return
it
.
trim
()
}
File
(
File
(
System
.
getProperty
(
"user.dir"
)).
parent
,
"/bintray.user.txt"
).
let
{
local
->
if
(
local
.
exists
())
{
return
local
.
readText
().
trim
()
}
}
File
(
File
(
System
.
getProperty
(
"user.dir"
)),
"/bintray.user.txt"
).
let
{
local
->
if
(
local
.
exists
())
{
return
local
.
readText
().
trim
()
}
}
error
(
"Cannot find bintray user, "
+
"please specify by creating a file bintray.user.txt in project dir, "
+
"or by providing JVM parameter 'bintray_user'"
)
}
@JvmStatic
fun
getKey
(
project
:
Project
):
String
{
kotlin
.
runCatching
{
@Suppress
(
"UNUSED_VARIABLE"
,
"LocalVariableName"
)
val
bintray_key
:
String
by
project
return
bintray_key
}
System
.
getProperty
(
"bintray_key"
,
null
)
?.
let
{
return
it
.
trim
()
}
File
(
File
(
System
.
getProperty
(
"user.dir"
)).
parent
,
"/bintray.key.txt"
).
let
{
local
->
if
(
local
.
exists
())
{
return
local
.
readText
().
trim
()
}
}
File
(
File
(
System
.
getProperty
(
"user.dir"
)),
"/bintray.key.txt"
).
let
{
local
->
if
(
local
.
exists
())
{
return
local
.
readText
().
trim
()
}
}
error
(
"Cannot find bintray key, "
+
"please specify by creating a file bintray.key.txt in project dir, "
+
"or by providing JVM parameter 'bintray_key'"
)
}
}
\ No newline at end of file
gradle/publish-japt.gradle
deleted
100644 → 0
View file @
3f7bba77
// 部分源码来自 kotlinx.coroutines
def
pomConfig
=
{
licenses
{
license
{
name
"AGPL-V3"
url
"https://www.gnu.org/licenses/agpl-3.0.txt"
distribution
"repo"
}
}
developers
{
developer
{
id
"mamoe"
name
"Mamoe Technologies"
}
}
scm
{
url
"https://github.com/mamoe/mirai"
}
}
bintray
{
def
keyProps
=
new
Properties
()
def
keyFile
=
file
(
"../keys.properties"
)
if
(
keyFile
.
exists
())
keyFile
.
withInputStream
{
keyProps
.
load
(
it
)
}
user
=
keyProps
.
getProperty
(
"bintrayUser"
)
key
=
keyProps
.
getProperty
(
"bintrayKey"
)
pkg
{
repo
=
'mirai'
name
=
"mirai-japt"
licenses
=
[
'AGPL'
]
vcsUrl
=
'https://github.com/mamoe/mirai'
}
}
afterEvaluate
{
project
.
publishing
.
publications
.
forEach
{
publication
->
publication
.
pom
.
withXml
{
def
root
=
asNode
()
//root.appendNode('groupId', project.group)
//root.appendNode('artifactId', project.name)
//root.appendNode('version', project.version)
root
.
appendNode
(
'name'
,
project
.
name
)
root
.
appendNode
(
'description'
,
project
.
description
)
root
.
appendNode
(
'url'
,
'https://github.com/mamoe/mirai'
)
root
.
children
().
last
()
+
pomConfig
}
}
}
bintrayUpload
.
doFirst
{
publications
=
project
.
publishing
.
publications
}
bintrayUpload
.
dependsOn
{
def
list
=
new
LinkedList
<
Task
>()
list
.
add
(
tasks
.
getByName
(
"build"
))
list
.
addAll
(
tasks
.
findAll
{
task
->
task
.
name
.
contains
(
'Jar'
)
})
list
.
addAll
(
tasks
.
findAll
{
task
->
task
.
name
.
startsWith
(
'generateMetadataFileFor'
)
})
list
.
addAll
(
tasks
.
findAll
{
task
->
task
.
name
.
startsWith
(
'generatePomFileFor'
)
})
list
}
// empty xxx-javadoc.jar
task
javadocJar
(
type:
Jar
)
{
archiveClassifier
=
'javadoc'
}
publishing
{
publications
.
all
{
// add empty javadocs (no need for MPP root publication which publishes only pom file)
if
(
it
.
name
!=
'kotlinMultiplatform'
)
{
it
.
artifact
(
javadocJar
)
}
// Rename MPP artifacts for backward compatibility
def
type
=
it
.
name
switch
(
type
)
{
case
'kotlinMultiplatform'
:
it
.
artifactId
=
"$project.name"
break
case
'metadata'
:
it
.
artifactId
=
"$project.name-common"
break
case
'jvm'
:
it
.
artifactId
=
"$project.name"
break
case
'js'
:
case
'native'
:
it
.
artifactId
=
"$project.name-$type"
break
}
// disable metadata everywhere, but in native modules
if
(
type
==
'maven'
||
type
==
'metadata'
||
type
==
'jvm'
||
type
==
'js'
)
{
moduleDescriptorGenerator
=
null
}
}
}
\ No newline at end of file
gradle/publish.gradle
View file @
40c22f42
import
upload.Bintray
// 部分源码来自 kotlinx.coroutines
// 部分源码来自 kotlinx.coroutines
// Source code from kotlinx.coroutines
// Source code from kotlinx.coroutines
...
@@ -22,12 +24,8 @@ def pomConfig = {
...
@@ -22,12 +24,8 @@ def pomConfig = {
}
}
bintray
{
bintray
{
def
keyProps
=
new
Properties
()
user
=
Bintray
.
getUser
(
project
)
def
keyFile
=
file
(
"../keys.properties"
)
key
=
Bintray
.
getKey
(
project
)
if
(
keyFile
.
exists
())
keyFile
.
withInputStream
{
keyProps
.
load
(
it
)
}
user
=
keyProps
.
getProperty
(
"bintrayUser"
)
key
=
keyProps
.
getProperty
(
"bintrayKey"
)
pkg
{
pkg
{
repo
=
'mirai'
repo
=
'mirai'
...
@@ -67,14 +65,14 @@ bintrayUpload.dependsOn {
...
@@ -67,14 +65,14 @@ bintrayUpload.dependsOn {
list
list
}
}
try
{
try
{
// empty xxx-javadoc.jar
// empty xxx-javadoc.jar
task
javadocJar
(
type:
Jar
)
{
task
javadocJar
(
type:
Jar
)
{
archiveClassifier
=
'javadoc'
archiveClassifier
=
'javadoc'
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
ignored
)
{
}
}
publishing
{
publishing
{
...
...
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