@@ -6,13 +6,16 @@ plugins {
66}
77
88group = " net.azisaba.data"
9- version = " 1 .0-SNAPSHOT"
9+ version = System .getenv( " VERSION " ) ? : " 0.0 .0-SNAPSHOT"
1010
11- configure(subprojects.filter { it.childProjects.isEmpty() }) {
11+ val leafProjects = subprojects.filter { it.childProjects.isEmpty() }
12+
13+ configure(leafProjects) {
1214 group = rootProject.group
1315 version = rootProject.version
1416
1517 apply (plugin = " java-library" )
18+ apply (plugin = " maven-publish" )
1619 apply (plugin = " org.jetbrains.kotlin.jvm" )
1720
1821 repositories {
@@ -30,4 +33,35 @@ configure(subprojects.filter { it.childProjects.isEmpty() }) {
3033 configure<JavaPluginExtension > {
3134 toolchain.languageVersion.set(JavaLanguageVersion .of(21 ))
3235 }
36+
37+ configure<PublishingExtension > {
38+ publications {
39+ create<MavenPublication >(" mavenJava" ) {
40+ from(components[" java" ])
41+ groupId = group.toString()
42+ artifactId = project.name
43+ version = version.toString()
44+ }
45+ }
46+ repositories {
47+ maven {
48+ name = " azisaba"
49+ url = if (version.toString().endsWith(" SNAPSHOT" )) {
50+ uri(" https://repo.azisaba.net/repository/maven-snapshots/" )
51+ } else {
52+ uri(" https://repo.azisaba.net/repository/maven-releases/" )
53+ }
54+ credentials {
55+ username = System .getenv(" REPO_USERNAME" )
56+ password = System .getenv(" REPO_PASSWORD" )
57+ }
58+ }
59+ }
60+ }
61+ }
62+
63+ tasks.register(" publishAll" ) {
64+ dependsOn(
65+ leafProjects.map { " ${it.path} :publish" }
66+ )
3367}
0 commit comments