Skip to content

Commit

Permalink
Merge pull request #74 from sirano11/maven
Browse files Browse the repository at this point in the history
Using a maven-publish plugin instead to bintray plugin to upload library.
  • Loading branch information
kale authored May 21, 2021
2 parents 7e1b4b7 + c90ad99 commit e68c347
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 49 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
- run:
name: "publish"
command: |
./gradlew clean build -x test --debug
./gradlew bintrayUpload --stacktrace --debug
./gradlew clean publish --stacktrace --debug
./gradlew closeAndReleaseRepository --stacktrace --debug
- store_artifacts:
path: ./build
- notify-failure
Expand All @@ -100,8 +100,8 @@ jobs:
- run:
name: "build and publish for android"
command: |
./gradlew clean build -x test --debug
./gradlew bintrayUpload --stacktrace --debug
./gradlew clean publish --stacktrace --debug
./gradlew closeAndReleaseRepository --stacktrace --debug
- store_artifacts:
path: ./build
- notify-failure
Expand Down
67 changes: 22 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ plugins {
id 'signing'
id 'idea'

id "com.jfrog.bintray" version "1.8.5"
id 'io.codearte.nexus-staging' version "0.30.0"
}

//It should only be applied on the ROOT project in a build.
apply plugin: 'io.codearte.nexus-staging'

allprojects {
version '1.1.1'
group 'xyz.groundx.caver'
Expand All @@ -23,7 +26,6 @@ allprojects {
apply plugin: 'java'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'


repositories {
Expand Down Expand Up @@ -59,9 +61,10 @@ allprojects {
}

ext {
bintrayUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
bintrayKey = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
bintrayGpgPassphrase = project.hasProperty('bintrayGpgPassphrase') ? project.property('bintrayGpgPassphrase') : System.getenv('BINTRAY_GPG_PASSPHRASE')
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : System.getenv('OSSRH_USERNAME')
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : System.getenv('OSSRH_PASSWORD')
ossrhSigningKey_base64 = project.hasProperty('signingKey')? project.property('signingKey') : System.getenv('ORG_GRADLE_PROJECT_signingKey')
ossrhSigningPassword = project.hasProperty('signingKey')? project.property('signingPassword') : System.getenv('ORG_GRADLE_PROJECT_signingPassword')

isAndroidBuild = project.version.endsWith("-android")
}
Expand Down Expand Up @@ -100,52 +103,26 @@ allprojects {
}
}
}
}

bintray {
user = bintrayUser
key = bintrayKey
publications = ['mavenJava']
publish = true
pkg {
desc = project.description
repo = 'maven'
name = 'caver-java-ext-kas'
licenses = ['Apache-2.0']
issueTrackerUrl = 'https://github.com/ground-x/caver-java-ext-kas/issues'
vcsUrl = 'https://github.com/ground-x/caver-java-ext-kas.git'
websiteUrl = 'https://www.klaytnapi.com'
publicDownloadNumbers = true

version {
name = project.version
desc = project.description
gpg {
sign = true
passphrase = bintrayGpgPassphrase
}
mavenCentralSync {
sync = false
repositories {
maven {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}

task release {
dependsOn 'build'
dependsOn 'bintrayUpload'

doLast {
if (!bintrayUser || !bintrayKey || !bintrayGpgPassphrase) {
throw new InvalidUserDataException("Required parameters missing: 'bintrayUser', 'bintrayKey', 'bintrayGpgPassphrase'")
}

logger.lifecycle(" - bintrayUser={}", bintrayUser)
logger.lifecycle(" - bintrayKey={}", bintrayKey ? "provided" : "not_provided")
logger.lifecycle(" - bintrayGpgPassphrase={}", bintrayGpgPassphrase ? "provided" : "not_provided")
}
signing {
def signingPassword = ossrhSigningPassword

tasks.findByName('bintrayUpload').mustRunAfter 'build'
def signingKey_base64 = ossrhSigningKey_base64
def signingKey = (signingKey_base64 == null? null:
new String(Base64.getMimeDecoder().decode(signingKey_base64.toString()), "utf-8"))

useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}


Expand Down

0 comments on commit e68c347

Please sign in to comment.