File tree Expand file tree Collapse file tree 4 files changed +42
-12
lines changed
plugins/src/main/kotlin/hexdebug Expand file tree Collapse file tree 4 files changed +42
-12
lines changed Original file line number Diff line number Diff line change @@ -45,31 +45,31 @@ pipeline {
4545 parallel {
4646 stage(" Maven" ) {
4747 steps {
48- echo " Publishing to Maven: ' ${ env.PUBLISH_MAVEN_RELEASE } ' "
48+ sh " ./gradlew publish "
4949 }
5050 }
5151 stage(" CurseForge" ) {
5252 when {
5353 expression { return params. PUBLISH_CURSEFORGE }
5454 }
5555 steps {
56- echo " Publishing to CurseForge "
56+ sh " ./gradlew publishCurseforge "
5757 }
5858 }
5959 stage(" Modrinth" ) {
6060 when {
6161 expression { return params. PUBLISH_MODRINTH }
6262 }
6363 steps {
64- echo " Publishing to Modrinth "
64+ sh " ./gradlew publishModrinth "
6565 }
6666 }
6767 stage(" GitHub" ) {
6868 when {
6969 expression { return params. PUBLISH_GITHUB }
7070 }
7171 steps {
72- echo " Publishing to GitHub "
72+ sh " ./gradlew publishGithub "
7373 }
7474 }
7575 }
Original file line number Diff line number Diff line change @@ -12,8 +12,13 @@ open class HexDebugProperties(private val project: Project) {
1212 val curseforgeId: String by project
1313 val modrinthId: String by project
1414
15- val javaVersion = project.libs.versions.java.get().toInt()
16- val minecraftVersion = project.libs.versions.minecraft.get()
15+ private val versions get() = project.libs.versions
16+
17+ val javaVersion = versions.java.get().toInt()
18+ val minecraftVersion = versions.minecraft.get()
19+
20+ val publishMavenRelease = System .getenv(" PUBLISH_MAVEN_RELEASE" ) == " true"
21+ val localMavenUrl = System .getenv(" local_maven_url" )?.let (project::uri)
1722
1823 fun getLatestChangelog () = project.rootProject.file(" CHANGELOG.md" ).useLines { lines ->
1924 lines.dropWhile { ! it.startsWith(SECTION_HEADER_PREFIX ) }
Original file line number Diff line number Diff line change @@ -8,7 +8,17 @@ import kotlin.io.path.div
88
99abstract class HexDebugArchitecturyExtension (private val project : Project ) : IHexDebugArchitecturyExtension {
1010 override fun platform (platform : String ) = project.run {
11- base.archivesName = " ${hexdebugProperties.modId} -$platform "
11+ val archivesName = " ${hexdebugProperties.modId} -$platform "
12+
13+ base.archivesName = archivesName
14+
15+ publishing {
16+ publications {
17+ named<MavenPublication >(" maven" ) {
18+ artifactId = archivesName
19+ }
20+ }
21+ }
1222 }
1323}
1424
@@ -61,3 +71,18 @@ tasks {
6171 dependsOn(jenkinsArtifacts)
6272 }
6373}
74+
75+ publishing {
76+ repositories {
77+ hexdebugProperties.localMavenUrl?.let {
78+ maven {
79+ url = it
80+ }
81+ }
82+ }
83+ publications {
84+ create<MavenPublication >(" maven" ) {
85+ from(components[" java" ])
86+ }
87+ }
88+ }
Original file line number Diff line number Diff line change @@ -40,11 +40,11 @@ repositories {
4040// testImplementation("org.jetbrains.kotlin:kotlin-test")
4141// }
4242
43- hexdebugProperties.also {
44- group = it .mavenGroup
45- version = " ${it .modVersion} +${it .minecraftVersion} "
46- System .getenv( " BUILD_NUMBER " )?. let { build ->
47- version = " $version -pre- $build "
43+ hexdebugProperties.also { props ->
44+ group = props .mavenGroup
45+ version = " ${props .modVersion} +${props .minecraftVersion} "
46+ if ( ! props.publishMavenRelease) {
47+ version = " $version -SNAPSHOT "
4848 }
4949}
5050
You can’t perform that action at this time.
0 commit comments