Skip to content

Commit

Permalink
Add maven central deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
ajalt committed Jun 23, 2018
1 parent 251095c commit 3513dde
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 43 deletions.
63 changes: 20 additions & 43 deletions clikt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ buildscript {
}

dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.2'
}
}

dokka {
outputDirectory = "$rootDir/docs/api"
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
Expand All @@ -35,49 +31,30 @@ task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
}

artifacts {
archives sourcesJar
archives javadocJar
archives sourcesJar
}

install {
repositories.mavenInstaller {
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
connection "https://github.com/ajalt/clikt.git"
url "https://github.com/ajalt/clikt"
}
developers {
developer {
name 'AJ Alt'
}
}
}
}
dokka {
outputDirectory = "$rootDir/docs/api"
}

bintray {
user = project.hasProperty('bintray.user') ? project.property('bintray.user') : ''
key = project.hasProperty('bintray.apikey') ? project.property('bintray.apikey') : ''
configurations = ['archives']
pkg {
repo = 'maven'
name = 'clikt'
licenses = ['Apache-2.0']
vcsUrl = "https://github.com/ajalt/clikt.git"

version {
name = project.version
desc = project.description
released = new Date()
vcsTag = project.version
}
ext {
pkgName = 'clikt'
pkgDesc = 'Intuitive command line interface parsing for Kotlin'
githubRepo = 'github.com/ajalt/clikt'
pkgLicense = 'Apache-2.0'
pkgLicenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
devInfo = {
id 'ajalt'
name 'AJ Alt'
url 'https://github.com/ajalt'
}
bintrayUser = System.getenv('BINTRAY_USER')
bintrayKey = System.getenv('BINTRAY_API_KEY')
mavenUserToken = System.getenv('MAVEN_USER_TOKEN')
mavenUserPass = System.getenv('MAVEN_USER_PASS')
deployDryRun = false
}

apply from: new File(rootDir, 'deploy.gradle')
75 changes: 75 additions & 0 deletions deploy.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
repositories {
mavenCentral()
}

apply plugin: 'maven'

def versionTag = version.toString()
def githubUrl = 'https://' + githubRepo
def scmUrl = 'scm:git:git://' + githubRepo + '.git'

bintray {
user = bintrayUser
key = bintrayKey
dryRun = deployDryRun ? true : false // Whether to run this as dry-run, without deploying
publish = true // If version should be auto published after an upload
configurations = ['archives'] // Use the archives Configuration.
pkg {
repo = 'maven'
name = pkgName
userOrg = user
licenses = [pkgLicense]
publicDownloadNumbers = false
vcsUrl = githubUrl + '.git'
desc = pkgDesc
websiteUrl = githubUrl
issueTrackerUrl = githubUrl + '/issues'
version {
name = versionTag
desc = pkgDesc
vcsTag = versionTag
released = new Date()
gpg {
sign = true // Determines whether to GPG sign the files.
}
mavenCentralSync {
sync = true // Optional (true by default). Determines whether to sync the version to Maven Central.
user = mavenUserToken // OSS user token
password = mavenUserPass // OSS user password
close = '1' // Close staging repository and release artifacts to Maven Central. Default = 1 (true). Set to 0 = You will release the version manually.
}
}
}
}

install {
repositories.mavenInstaller {
pom.name = pkgName
pom.version = versionTag
pom.artifactId = pkgName
pom.project {
name pkgName
packaging 'bundle'
description pkgDesc
url githubUrl

scm {
url githubUrl
connection scmUrl
developerConnection scmUrl
}

developers {
developer devInfo
}

licenses {
license {
name pkgLicense
url pkgLicenseUrl
distribution 'repo'
}
}
}
}
}

0 comments on commit 3513dde

Please sign in to comment.