From 831c8733cc7870c927bcfe54ff67f82fa7466283 Mon Sep 17 00:00:00 2001 From: Prototik Date: Sun, 28 Jun 2015 04:35:19 +0700 Subject: [PATCH] Migrate to gitlab ci 7.12 --- .gitlab-ci.yml | 82 +++++++++++++++++++ build.gradle | 4 +- .../groovy/kcauldron/VersionParser.groovy | 13 ++- 3 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..bda75c8 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,82 @@ +Compile: + script: + - git submodule update --init --recursive + - ./gradlew clean setupCauldron jar + tags: + - test + only: + - master + - backport-1388 + - backport-1370 + - backport-1291 + - backport-1240 + +Deploy: + script: + - git submodule update --init --recursive + - ./gradlew -PofficialBuild clean setupCauldron publish + type: deploy + tags: + - deploy + only: + - master + - backport-1388 + - backport-1370 + - backport-1291 + - backport-1240 + +Merge master to backport-1388: + script: + - git remote set-url origin gitlab@prok.pw:Prototik/KCauldron.git + - git fetch origin + - git checkout backport-1388 + - git reset --hard origin/backport-1388 + - git merge origin/master + - git push origin backport-1388 + type: deploy + tags: + - merge-backport + only: + - master + +Merge backport-1388 to backport-1370: + script: + - git remote set-url origin gitlab@prok.pw:Prototik/KCauldron.git + - git fetch origin + - git checkout backport-1370 + - git reset --hard origin/backport-1370 + - git merge origin/backport-1388 + - git push origin backport-1370 + type: deploy + tags: + - merge-backport + only: + - backport-1388 + +Merge backport-1370 to backport-1291: + script: + - git remote set-url origin gitlab@prok.pw:Prototik/KCauldron.git + - git fetch origin + - git checkout backport-1291 + - git reset --hard origin/backport-1291 + - git merge origin/backport-1370 + - git push origin backport-1291 + type: deploy + tags: + - merge-backport + only: + - backport-1370 + +Merge backport-1291 to backport-1240: + script: + - git remote set-url origin gitlab@prok.pw:Prototik/KCauldron.git + - git fetch origin + - git checkout backport-1240 + - git reset --hard origin/backport-1240 + - git merge origin/backport-1291 + - git push origin backport-1240 + type: deploy + tags: + - merge-backport + only: + - backport-1291 diff --git a/build.gradle b/build.gradle index 8740ff7..4ad408a 100644 --- a/build.gradle +++ b/build.gradle @@ -97,7 +97,7 @@ def gitInfo(String key) { } ext.mcVersion = "1.7.10" -ext.forgeVersion = "1481" +ext.forgeVersion = VersionParser.parseForgeRevision(file('src/main/resources/fmlversion.properties')) ext.revision = project.hasProperty('revision') ? project.getProperty('revision') : buildInfo('nextBuildNumber') version = "${mcVersion}-${forgeVersion}.${revision}" if (project.hasProperty('officialBuild')) println "Updated KCauldron version: ${version}" @@ -179,7 +179,7 @@ def generateManifest(boolean legacy = false) { 'Specification-Vendor' : 'Bukkit Team', 'Specification-Title' : 'Bukkit', 'Specification-Version' : '1.7.10-R0.1-SNAPSHOT', - 'Forge-Version' : VersionParser.parseForgeRevision(file('forge/src/main/java/net/minecraftforge/common/ForgeVersion.java'), file('src/main/resources/fmlversion.properties')), + 'Forge-Version' : VersionParser.parseForgeVersion(file('forge/src/main/java/net/minecraftforge/common/ForgeVersion.java'), file('src/main/resources/fmlversion.properties')), 'TweakClass' : 'cpw.mods.fml.common.launcher.FMLTweaker', 'Main-Class' : 'cpw.mods.fml.relauncher.ServerLaunchWrapper', 'Class-Path' : generateClasspath(legacy) diff --git a/buildSrc/src/main/groovy/kcauldron/VersionParser.groovy b/buildSrc/src/main/groovy/kcauldron/VersionParser.groovy index 94c66b1..fb67863 100644 --- a/buildSrc/src/main/groovy/kcauldron/VersionParser.groovy +++ b/buildSrc/src/main/groovy/kcauldron/VersionParser.groovy @@ -3,17 +3,22 @@ package kcauldron import java.util.regex.Matcher class VersionParser { - public static String parseForgeRevision(File forgeFile, File propsFile) { + public static String parseForgeVersion(File forgeFile, File propsFile) { def forgeVersion = forgeFile.text def int majorVersion = v(forgeVersion =~ /.+int majorVersion\s+=\s+(\d+);/) def int minorVersion = v(forgeVersion =~ /.+int minorVersion\s+=\s+(\d+);/) def int revisionVersion = v(forgeVersion =~ /.+int revisionVersion\s+=\s+(\d+);/) - def props = new Properties(); - propsFile.withInputStream { props.load(it) } - def int buildVersion = props['fmlbuild.build.number'] as int + def int buildVersion = parseForgeRevision propsFile return "${majorVersion}.${minorVersion}.${revisionVersion}.${buildVersion}" } + def static int parseForgeRevision(File propsFile) { + def props = new Properties(); + propsFile.withInputStream { props.load(it) } + props['fmlbuild.build.number'] as int + } + + static int v(Matcher matcher) { matcher.find() matcher.group(1) as int