Skip to content

Commit

Permalink
build: move repository name to gradle.properties, use default passwor…
Browse files Browse the repository at this point in the history
…d credentials for maven publishing
  • Loading branch information
yusshu committed Jun 16, 2022
1 parent 93c9664 commit 74a5a50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
17 changes: 6 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,18 @@ java {
}
}

val repositoryName: String by project
val snapshotRepository: String by project
val releaseRepository: String by project

publishing {
repositories {
maven {
url = if (project.version.toString().endsWith("-SNAPSHOT")) {
uri(snapshotRepository)
} else {
uri(releaseRepository)
}
credentials {
username = project.properties["UNNAMED_REPO_USER"] as String?
?: System.getenv("REPO_USER")
password = project.properties["UNNAMED_REPO_PASSWORD"] as String?
?: System.getenv("REPO_PASSWORD")
}
val snapshot = project.version.toString().endsWith("-SNAPSHOT")

name = repositoryName
url = if (snapshot) { uri(snapshotRepository) } else { uri(releaseRepository) }
credentials(PasswordCredentials::class)
}
}
publications {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
group=team.unnamed
version=0.1.0

repositoryName=unnamedRepository
snapshotRepository=https\://repo.unnamed.team/repository/unnamed-snapshots/
releaseRepository=https\://repo.unnamed.team/repository/unnamed-releases/

0 comments on commit 74a5a50

Please sign in to comment.