diff --git a/Jenkinsfile b/Jenkinsfile index 49beb25af..905805284 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,7 @@ pipeline { publisherStrategy: 'EXPLICIT' ) { scmSkip(deleteBuild: true, skipPattern:'.*\\[CI-SKIP\\].*') + sh 'git fetch --tags' sh 'chmod +x ./gradlew' sh './gradlew clean build' } diff --git a/build.gradle b/build.gradle index 228668cef..a443279f9 100644 --- a/build.gradle +++ b/build.gradle @@ -8,9 +8,11 @@ sourceCompatibility = JavaVersion.VERSION_16 targetCompatibility = JavaVersion.VERSION_16 archivesBaseName = "${project.archives_base_name}-mc${project.minecraft_version}" -version = project.mod_version +version = project.mod_version + "." + commitsSinceLastTag() group = project.maven_group +getLogger().info("Version String: ${version}") + loom { accessWidener "src/main/resources/c2me.accesswidener" } @@ -87,3 +89,17 @@ publishing { // mavenLocal() } } + +String commitsSinceLastTag() { + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'describe', '--tags' + standardOutput = stdout + } + stdout = stdout.toString() + if (stdout.indexOf('-') < 0) { + return 0; + } + def split = stdout.split('-') + return split[split.length - 2] +} diff --git a/gradle.properties b/gradle.properties index 57ddd73d4..a337bf5a1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ minecraft_version=1.17.1-pre1 yarn_mappings=1.17.1-pre1+build.1 loader_version=0.11.3 # Mod Properties -mod_version=0.1-SNAPSHOT +mod_version=0.2.0+alpha.1 maven_group=com.ishland.c2me archives_base_name=c2me-fabric # Java Dependencies