From 618276c269536f3f31de838e48f0bf83a6e02e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Jaro=C5=A1?= Date: Sat, 8 Mar 2025 15:58:27 +0100 Subject: [PATCH] Fix release both game version --- Jenkinsfile | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 98cfa9e..ca2d6f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,22 +36,19 @@ def writeToCVersion = { String tocFile, String current, String next -> writeFile(file: tocFile, text: content) } -def generateOutput = { String game -> +def createZipFile = { String game -> + def tocFile = tocFiles[game] + // prepare output folder sh "mkdir -p $outputFolder" // copy toc file - def tocFile = tocFiles[game] sh "cp $tocFile $outputFolder" // copy files sh "find . -name '*.lua' -exec rsync -av {} $outputFolder \\;" sh "find . -name '*.tga' -exec rsync -av {} $outputFolder \\;" sh "find . -name '*.ttf' -exec rsync -av {} $outputFolder \\;" -} - -def createReleaseFile = { String game -> - def tocFile = tocFiles[game] // get version def currentVersion = readToCVersion(tocFile) @@ -66,15 +63,18 @@ def createReleaseFile = { String game -> // save version writeToCVersion(tocFile, currentVersion, newVersion) +} - // commit new version - def tag = "v$newVersion" +def pushToGit = { String game -> + def tocFile = tocFiles[game] + def version = readToCVersion(tocFile) + def tag = "v$version" sh "git checkout ${BRANCH_NAME}" - sh "git add $tocFile" - sh "git commit -m 'Release ${tag}'" + sh "git add *.toc" + sh "git commit -m 'Release $tag'" sh "git push" - sh "git tag ${tag}" - sh "git push origin ${tag}" + sh "git tag $tag" + sh "git push origin $tag" } MasterJob [:], { -> @@ -88,25 +88,16 @@ MasterJob [:], { -> stageWhen('build') { def game = params.GAME if (game == "all") { - generateOutput("classic_era") - generateOutput("retail") + createZipFile("classic_era") + createZipFile("retail") } else { - generateOutput(game) + createZipFile(game) } - } - - stageWhen('make release') { - def game = params.GAME forgejoGit() - if (game == "all") { - createReleaseFile("classic_era") - createReleaseFile("retail") - } else { - createReleaseFile(game) - } + pushToGit(game) } - stageWhen('upload release') { + stageWhen('release') { def game = params.GAME def tocFile = tocFiles[game] def version = readToCVersion(tocFile)