Skip to content

Commit 3513dde

Browse files
committed
Add maven central deployment
1 parent 251095c commit 3513dde

File tree

2 files changed

+95
-43
lines changed

2 files changed

+95
-43
lines changed

clikt/build.gradle

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ buildscript {
1111
}
1212

1313
dependencies {
14-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
14+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.2'
1515
}
1616
}
1717

18-
dokka {
19-
outputDirectory = "$rootDir/docs/api"
20-
}
21-
2218
task sourcesJar(type: Jar, dependsOn: classes) {
2319
classifier = 'sources'
2420
from sourceSets.main.allSource
@@ -35,49 +31,30 @@ task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
3531
}
3632

3733
artifacts {
38-
archives sourcesJar
3934
archives javadocJar
35+
archives sourcesJar
4036
}
4137

42-
install {
43-
repositories.mavenInstaller {
44-
pom.project {
45-
licenses {
46-
license {
47-
name 'The Apache Software License, Version 2.0'
48-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
49-
distribution 'repo'
50-
}
51-
}
52-
scm {
53-
connection "https://github.com/ajalt/clikt.git"
54-
url "https://github.com/ajalt/clikt"
55-
}
56-
developers {
57-
developer {
58-
name 'AJ Alt'
59-
}
60-
}
61-
}
62-
}
38+
dokka {
39+
outputDirectory = "$rootDir/docs/api"
6340
}
6441

65-
bintray {
66-
user = project.hasProperty('bintray.user') ? project.property('bintray.user') : ''
67-
key = project.hasProperty('bintray.apikey') ? project.property('bintray.apikey') : ''
68-
configurations = ['archives']
69-
pkg {
70-
repo = 'maven'
71-
name = 'clikt'
72-
licenses = ['Apache-2.0']
73-
vcsUrl = "https://github.com/ajalt/clikt.git"
74-
75-
version {
76-
name = project.version
77-
desc = project.description
78-
released = new Date()
79-
vcsTag = project.version
80-
}
42+
ext {
43+
pkgName = 'clikt'
44+
pkgDesc = 'Intuitive command line interface parsing for Kotlin'
45+
githubRepo = 'github.com/ajalt/clikt'
46+
pkgLicense = 'Apache-2.0'
47+
pkgLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
48+
devInfo = {
49+
id 'ajalt'
50+
name 'AJ Alt'
51+
url 'https://github.com/ajalt'
8152
}
53+
bintrayUser = System.getenv('BINTRAY_USER')
54+
bintrayKey = System.getenv('BINTRAY_API_KEY')
55+
mavenUserToken = System.getenv('MAVEN_USER_TOKEN')
56+
mavenUserPass = System.getenv('MAVEN_USER_PASS')
57+
deployDryRun = false
8258
}
8359

60+
apply from: new File(rootDir, 'deploy.gradle')

deploy.gradle

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
repositories {
2+
mavenCentral()
3+
}
4+
5+
apply plugin: 'maven'
6+
7+
def versionTag = version.toString()
8+
def githubUrl = 'https://' + githubRepo
9+
def scmUrl = 'scm:git:git://' + githubRepo + '.git'
10+
11+
bintray {
12+
user = bintrayUser
13+
key = bintrayKey
14+
dryRun = deployDryRun ? true : false // Whether to run this as dry-run, without deploying
15+
publish = true // If version should be auto published after an upload
16+
configurations = ['archives'] // Use the archives Configuration.
17+
pkg {
18+
repo = 'maven'
19+
name = pkgName
20+
userOrg = user
21+
licenses = [pkgLicense]
22+
publicDownloadNumbers = false
23+
vcsUrl = githubUrl + '.git'
24+
desc = pkgDesc
25+
websiteUrl = githubUrl
26+
issueTrackerUrl = githubUrl + '/issues'
27+
version {
28+
name = versionTag
29+
desc = pkgDesc
30+
vcsTag = versionTag
31+
released = new Date()
32+
gpg {
33+
sign = true // Determines whether to GPG sign the files.
34+
}
35+
mavenCentralSync {
36+
sync = true // Optional (true by default). Determines whether to sync the version to Maven Central.
37+
user = mavenUserToken // OSS user token
38+
password = mavenUserPass // OSS user password
39+
close = '1' // Close staging repository and release artifacts to Maven Central. Default = 1 (true). Set to 0 = You will release the version manually.
40+
}
41+
}
42+
}
43+
}
44+
45+
install {
46+
repositories.mavenInstaller {
47+
pom.name = pkgName
48+
pom.version = versionTag
49+
pom.artifactId = pkgName
50+
pom.project {
51+
name pkgName
52+
packaging 'bundle'
53+
description pkgDesc
54+
url githubUrl
55+
56+
scm {
57+
url githubUrl
58+
connection scmUrl
59+
developerConnection scmUrl
60+
}
61+
62+
developers {
63+
developer devInfo
64+
}
65+
66+
licenses {
67+
license {
68+
name pkgLicense
69+
url pkgLicenseUrl
70+
distribution 'repo'
71+
}
72+
}
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)