@@ -7,7 +7,6 @@ plugins {
7
7
}
8
8
9
9
group = " dev.bazhard.library"
10
- version = " 1.0.0-SNAPSHOT"
11
10
description = " A 3D GUI library for Minecraft plugins"
12
11
13
12
java {
@@ -30,24 +29,24 @@ publishing {
30
29
name = " snapshot"
31
30
url = uri(" https://repo.bazhard.dev/repository/maven-snapshots/" )
32
31
credentials {
33
- username = mavenCredentials?.first ? : " "
34
- password = mavenCredentials?.second ? : " "
32
+ username = mavenCredentials?.first ? : System .getenv( " PUBLISH_USERNAME " ) ? : " "
33
+ password = mavenCredentials?.second ? : System .getenv( " PUBLISH_PASSWORD " ) ? : " "
35
34
}
36
35
}
37
36
maven {
38
37
name = " release"
39
38
url = uri(" https://repo.bazhard.dev/repository/maven-releases/" )
40
39
credentials {
41
- username = mavenCredentials?.first ? : " "
42
- password = mavenCredentials?.second ? : " "
40
+ username = mavenCredentials?.first ? : System .getenv( " PUBLISH_USERNAME " ) ? : " "
41
+ password = mavenCredentials?.second ? : System .getenv( " PUBLISH_PASSWORD " ) ? : " "
43
42
}
44
43
}
45
44
}
46
45
}
47
46
48
47
repositories {
49
48
mavenCentral()
50
- maven( " https://repo.dmulloy2.net/repository/public/" ) // Required for ProtocolLib
49
+ maven(" https://repo.dmulloy2.net/repository/public/" ) // Required for ProtocolLib
51
50
maven(" https://repo.papermc.io/repository/maven-public/" )
52
51
}
53
52
@@ -72,6 +71,18 @@ tasks {
72
71
}
73
72
}
74
73
74
+ tasks.withType<PublishToMavenRepository >().configureEach {
75
+ onlyIf(" publishing snapshots to the snapshot repository and releases to the release repository" ) {
76
+ repository == publishing.repositories[if (version.toString().endsWith(" -SNAPSHOT" )) " snapshot" else " release" ]
77
+ }
78
+ }
79
+
80
+ tasks.register(" printVersion" ) {
81
+ doLast {
82
+ println (project.version)
83
+ }
84
+ }
85
+
75
86
fun getMavenCredentials (serverId : String ): Pair <String , String >? {
76
87
val settingsFile = File (System .getProperty(" user.home" ), " .m2/settings.xml" )
77
88
if (! settingsFile.exists()) {
@@ -92,4 +103,4 @@ fun getMavenCredentials(serverId: String): Pair<String, String>? {
92
103
}
93
104
}
94
105
return null
95
- }
106
+ }
0 commit comments