Skip to content

Commit e488fdf

Browse files
committed
Refactor publishing block to improve readability and maintainability
1 parent f01088f commit e488fdf

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

plugin/build.gradle.kts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,30 @@ data class Version(val major: Int, val minor: Int, val patch: Int) {
6363
}
6464

6565

66-
publishing {
67-
repositories {
68-
maven {
69-
url = if (preRelease) {
70-
uri("https://maven.lavalink.dev/snapshots")
71-
} else {
72-
uri("https://maven.lavalink.dev/releases")
73-
}
74-
credentials {
75-
username = System.getenv("USERNAME")
76-
password = System.getenv("PASSWORD")
77-
}
78-
authentication {
79-
create<BasicAuthentication>("basic")
66+
if (System.getenv("USERNAME") != null && System.getenv("PASSWORD") != null) {
67+
publishing {
68+
repositories {
69+
maven {
70+
url = if (preRelease) {
71+
uri("https://maven.lavalink.dev/snapshots")
72+
} else {
73+
uri("https://maven.lavalink.dev/releases")
74+
}
75+
credentials {
76+
username = System.getenv("USERNAME")
77+
password = System.getenv("PASSWORD")
78+
}
79+
authentication {
80+
create<BasicAuthentication>("basic")
81+
}
8082
}
8183
}
82-
}
8384

84-
publications {
85-
create<MavenPublication>("jiosaavn-plugin") {
86-
artifactId = "jiosaavn-plugin"
87-
from(components["java"])
85+
publications {
86+
create<MavenPublication>("jiosaavn-plugin") {
87+
artifactId = "jiosaavn-plugin"
88+
from(components["java"])
89+
}
8890
}
8991
}
9092
}

0 commit comments

Comments
 (0)