From 71af32aa68144c870369d96a1112ff566cab1d68 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sun, 9 Apr 2023 20:06:41 -0500 Subject: [PATCH] fix version and deploy --- build.gradle | 22 ++++++++++++---------- gradle.properties | 2 ++ src/main/resources/plugin.yml | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 gradle.properties diff --git a/build.gradle b/build.gradle index ee6d4296..52d611a0 100644 --- a/build.gradle +++ b/build.gradle @@ -8,11 +8,10 @@ group = 'com.comphenix.protocol' version = '5.0.0-SNAPSHOT' description = 'Provides access to the Minecraft protocol' -// java.sourceCompatibility = JavaVersion.VERSION_17 -// java.targetCompatibility = JavaVersion.VERSION_17 +def isSnapshot = version.endsWith('-SNAPSHOT') repositories { - // mavenLocal() + // mavenLocal() // can speed up build, but may fail in CI mavenCentral() maven { @@ -41,7 +40,6 @@ dependencies { compileOnly 'net.kyori:adventure-text-serializer-gson:4.13.0' compileOnly 'com.googlecode.json-simple:json-simple:1.1.1' - // testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' testImplementation 'org.mockito:mockito-core:4.11.0' @@ -72,13 +70,12 @@ test { } processResources { - def fullVersion = System.getenv('BUILD_NUMBER') + def includeBuild = isSnapshot && System.getenv('BUILD_NUMBER') + def fullVersion = includeBuild ? version + '-' + System.getenv('BUILD_NUMBER') : version - filter { - it.replace('${project.version}', fullVersion) - } + eachFile { expand(['version': fullVersion]) } } publishing { @@ -90,13 +87,18 @@ publishing { artifactId = 'ProtocolLib' } } - } + repositories { maven { - url = version.endsWith('SNAPSHOT') + url isSnapshot ? 'https://repo.dmulloy2.net/repository/snapshots/' : 'https://repo.dmulloy2.net/repository/releases/' + + credentials { + username project.nexusUsername + password project.nexusPassword + } } } } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..cdfa8a4e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +nexusUsername="" +nexusPassword="" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4de8994d..3db7f73c 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ProtocolLib -version: ${project.fullVersion} +version: ${version} description: Provides read/write access to the Minecraft protocol. authors: [dmulloy2, comphenix]