Skip to content

Commit

Permalink
update seperate publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani committed Dec 14, 2022
1 parent ac8d6b9 commit fd67695
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 15 deletions.
30 changes: 22 additions & 8 deletions compose/gradle/publish-to-central.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

// --- Prepare Settings ---
static def isReleaseBuild() {
return System.getenv('IS_RELEASE') == "true" ?: false
}

def getRepositoryUsername() {
return findProperty('SONATYPE_NEXUS_USERNAME') ?: System.getenv('SONATYPE_NEXUS_USERNAME') ?: ""
return findProperty('OSSRH_USERNAME') ?: System.getenv('OSSRH_USERNAME') ?: ""
}

def getRepositoryPassword() {
return findProperty('SONATYPE_NEXUS_PASSWORD') ?: System.getenv('SONATYPE_NEXUS_PASSWORD') ?: ""
return findProperty('OSSRH_PASSWORD') ?: System.getenv('OSSRH_PASSWORD') ?: ""
}
def getSigningKeyId() {
return findProperty('SIGNING_KEY_ID') ?: System.getenv('SIGNING_KEY_ID') ?: ""
}
def getSigningKey() {
return findProperty('SIGNING_KEY') ?: System.getenv('SIGNING_KEY') ?: ""
}
def getSigningPassword() {
return findProperty('SIGNING_PASSWORD') ?: System.getenv('SIGNING_PASSWORD') ?: ""
}

if (!project.tasks.findByName('sourcesJar')) {
Expand All @@ -19,7 +27,7 @@ if (!project.tasks.findByName('sourcesJar')) {
if (pluginManager.hasPlugin('com.android.library')) {
from android.sourceSets.main.java.srcDirs
} else {
from sourceSets.main.java.srcDirs
from sourceSets.main.allSource.srcDirs
}
}
}
Expand All @@ -29,6 +37,8 @@ artifacts {
archives sourcesJar
}

// --- Publish ---

// OSS Sonatype Repo
// s01.oss.sonatype.com
def OSSRepo = "s01.oss.sonatype.org"
Expand Down Expand Up @@ -105,15 +115,19 @@ afterEvaluate {

if (isReleaseBuild()) {
signing {
useInMemoryPgpKeys(
getSigningKeyId(),
getSigningKey(),
getSigningPassword(),
)

if (pluginManager.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
publishing.publications.all {
sign it
}
} else {
sign publishing.publications.release
}

// useGpgCmd()
}
}
}
}
28 changes: 21 additions & 7 deletions ktor/gradle/publish-to-central.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

// --- Prepare Settings ---
static def isReleaseBuild() {
return System.getenv('IS_RELEASE') == "true" ?: false
}

def getRepositoryUsername() {
return findProperty('SONATYPE_NEXUS_USERNAME') ?: System.getenv('SONATYPE_NEXUS_USERNAME') ?: ""
return findProperty('OSSRH_USERNAME') ?: System.getenv('OSSRH_USERNAME') ?: ""
}

def getRepositoryPassword() {
return findProperty('SONATYPE_NEXUS_PASSWORD') ?: System.getenv('SONATYPE_NEXUS_PASSWORD') ?: ""
return findProperty('OSSRH_PASSWORD') ?: System.getenv('OSSRH_PASSWORD') ?: ""
}
def getSigningKeyId() {
return findProperty('SIGNING_KEY_ID') ?: System.getenv('SIGNING_KEY_ID') ?: ""
}
def getSigningKey() {
return findProperty('SIGNING_KEY') ?: System.getenv('SIGNING_KEY') ?: ""
}
def getSigningPassword() {
return findProperty('SIGNING_PASSWORD') ?: System.getenv('SIGNING_PASSWORD') ?: ""
}

if (!project.tasks.findByName('sourcesJar')) {
Expand All @@ -29,6 +37,8 @@ artifacts {
archives sourcesJar
}

// --- Publish ---

// OSS Sonatype Repo
// s01.oss.sonatype.com
def OSSRepo = "s01.oss.sonatype.org"
Expand Down Expand Up @@ -105,15 +115,19 @@ afterEvaluate {

if (isReleaseBuild()) {
signing {
useInMemoryPgpKeys(
getSigningKeyId(),
getSigningKey(),
getSigningPassword(),
)

if (pluginManager.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
publishing.publications.all {
sign it
}
} else {
sign publishing.publications.release
}

// useGpgCmd()
}
}
}
}

0 comments on commit fd67695

Please sign in to comment.