Skip to content

Commit

Permalink
fix repo id
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Nov 23, 2023
1 parent 775bc16 commit 50bbba3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,16 @@ private val nexusStagingClient by lazy {
)
}

fun Project.getOrCreateOssStagingUrl(): Provider<String> {
fun Project.getOrCreateRepoId(): Provider<String> {
return getOrCreateRepoIdTask().map {
val repoId = it.outputs.files.singleFile.readText()
"${baseUrl}staging/deployByRepositoryId/$repoId/"
it.outputs.files.singleFile.readText()
}
}

fun Project.getOrCreateRepoUrl(): Provider<String> {
return getOrCreateRepoId().map { "${baseUrl}staging/deployByRepositoryId/$it/" }
}

@OptIn(ExperimentalTime::class)
fun Task.closeAndReleaseStagingRepository(repoId: String) {
runBlocking {
Expand All @@ -108,7 +111,7 @@ private fun Project.registerReleaseTask(name: String): TaskProvider<Task> {
val task = try {
rootProject.tasks.named(name)
} catch (e: UnknownDomainObjectException) {
val repoId = getOrCreateOssStagingUrl()
val repoId = getOrCreateRepoId()
rootProject.tasks.register(name) {
inputs.property(
"repoId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun RepositoryHandler.mavenSonatypeSnapshot(project: Project) = maven {
fun RepositoryHandler.mavenSonatypeStaging(project: Project) = maven {
name = "ossStaging"
setUrl {
project.uri(project.getOrCreateOssStagingUrl())
project.uri(project.getOrCreateRepoUrl())
}
credentials {
username = System.getenv(EnvVarKeys.Nexus.username)
Expand Down

0 comments on commit 50bbba3

Please sign in to comment.