Skip to content

Commit

Permalink
Fix publishing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudgiuliani committed Dec 20, 2023
1 parent 93d4f78 commit f825e32
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
30 changes: 22 additions & 8 deletions 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'

def isReleaseBuild() {
return !is_snaptshot
// --- 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()
}
}
}
3 changes: 0 additions & 3 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ ext {
koin_version = '3.2.4-rc1'
koin_android_version = '3.2.4-rc1'

// pass it to true to make release
is_snaptshot = true

// Kotlin
kotlin_version = '1.6.21'

Expand Down

0 comments on commit f825e32

Please sign in to comment.