| buildscript { |
| repositories { |
| mavenCentral() |
| maven { url "https://plugins.gradle.org/m2/" } |
| } |
| dependencies { |
| classpath "io.github.gradle-nexus:publish-plugin:1.1.0" |
| } |
| } |
| |
| ext.isSnapshot = project.projectVersion.endsWith("-SNAPSHOT") |
| ext.isReleaseVersion = !ext.isSnapshot |
| ext."signing.keyId" = System.getenv("SIGNING_KEY") ?: project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : null |
| ext."signing.password" = System.getenv("SIGNING_PASSPHRASE") ?: project.hasProperty("signing.password") ? project.getProperty('signing.password') : null |
| ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : null |
| |
| if (isReleaseVersion) { |
| apply plugin: "io.github.gradle-nexus.publish-plugin" |
| } |
| |
| if (isReleaseVersion) { |
| nexusPublishing { |
| repositories { |
| sonatype { |
| def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : '' |
| def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : '' |
| def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : '' |
| username = ossUser |
| password = ossPass |
| stagingProfileId = ossStagingProfileId |
| } |
| } |
| } |
| } |