Fix snapshot publishing (#4)

This commit is contained in:
Max Rumpf 2021-09-03 14:55:21 +02:00 committed by GitHub
parent 98ab3de282
commit db20b24984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -31,12 +31,16 @@ allprojects {
}
// Add Sonatype publishing repository
nexusPublishing.repositories.sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
nexusPublishing {
repositories.sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(getProperty("ossrh.username"))
password.set(getProperty("ossrh.password"))
username.set(getProperty("ossrh.username"))
password.set(getProperty("ossrh.password"))
}
useStaging.set(project.provider { project.version.toString() != SNAPSHOT_VERSION })
}
tasks.wrapper {

View File

@ -12,11 +12,13 @@ fun Project.getProperty(name: String): String? {
return value
}
const val SNAPSHOT_VERSION = "SNAPSHOT"
/**
* Helper function to create the library version using the `jellyfin.version` property.
* Uses [getProperty] to retrieve the properties. Defaults to `-SNAPSHOT` if no property is set.
*/
fun Project.createVersion(): String {
val jellyfinVersion = getProperty("jellyfin.version")?.removePrefix("v")
return jellyfinVersion ?: "SNAPSHOT"
return jellyfinVersion ?: SNAPSHOT_VERSION
}