diff --git a/CzechQuests_Mainline.toc b/CzechQuests_Mainline.toc index 006027b..e4b4ca4 100755 --- a/CzechQuests_Mainline.toc +++ b/CzechQuests_Mainline.toc @@ -2,7 +2,7 @@ ## Title: CzechQuests ## Notes: Addon displays texts of quests in Czech language ## Author: Roman Jaroš -## Version: 0.2.14 +## Version: 1.0.0 ## SavedVariables: CzechQuestsAddon_Store ## Category: Translations ## IconTexture: Interface\AddOns\CzechQuests\Assets\Icons\Logo diff --git a/CzechQuests_Vanilla.toc b/CzechQuests_Vanilla.toc index 8c53300..1448fdb 100755 --- a/CzechQuests_Vanilla.toc +++ b/CzechQuests_Vanilla.toc @@ -2,7 +2,7 @@ ## Title: CzechQuests ## Notes: Addon displays texts of quests in Czech language as tooltip ## Author: Roman Jaroš -## Version: 0.1.13 +## Version: 1.0.0 ## SavedVariables: CzechQuestsAddon_Store CzechQuests.lua diff --git a/Jenkinsfile b/Jenkinsfile index 98cfa9e..753aadb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,25 +7,21 @@ def SKIP = "skip" properties([parameters([ choice( name: 'RELEASE', - choices: ['patch', 'minor', 'major'], - description: 'Release new version' + choices: [SKIP, 'patch', 'minor', 'major'], + description: 'Next new version' ), - choice( - name: 'GAME', - choices: [SKIP, 'classic_era', 'retail', 'all'], - description: 'Create build with manual tag', - ) ])]) def outputFolder = "CzechQuests" + def tocFiles = [ "classic_era": "CzechQuests_Vanilla.toc", "retail" : "CzechQuests_Mainline.toc" ] -def readToCVersion = { String tocFile -> +def readToCVersion = { -> return sh( - script: "grep '## Version:' $tocFile | cut -d ' ' -f 3", + script: "grep '## Version:' ${tocFiles['classic_era']} | cut -d ' ' -f 3", returnStdout: true ).trim() } @@ -36,80 +32,72 @@ def writeToCVersion = { String tocFile, String current, String next -> writeFile(file: tocFile, text: content) } -def generateOutput = { String game -> +def increaseVersion = { -> + def currentVersion = readToCVersion() + def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE) + writeToCVersion(tocFiles['classic_era'], currentVersion, newVersion) + writeToCVersion(tocFiles['retail'], currentVersion, newVersion) +} + +def createZipFile = { String game -> + def tocFile = tocFiles[game] + def version = readToCVersion() + // 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) - def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE) // create zip - def zipFileName = "czech-quests-$game-v${newVersion}.zip" + def zipFileName = "czech-quests-$game-v${version}.zip" zip zipFile: zipFileName, archive: false, dir: outputFolder // remove build folder sh "rm -r $outputFolder" +} - // save version - writeToCVersion(tocFile, currentVersion, newVersion) - - // commit new version - def tag = "v$newVersion" +def pushToGit = { -> + def version = readToCVersion() sh "git checkout ${BRANCH_NAME}" - sh "git add $tocFile" - sh "git commit -m 'Release ${tag}'" + sh "git add *.toc" + sh "git commit -m 'Release $version'" sh "git push" - sh "git tag ${tag}" - sh "git push origin ${tag}" + sh "git tag $version" + sh "git push origin $version" +} + +def uploadToForgejo = { -> + def version = readToCVersion() + ForgejoRelease('czech-quests', 'addon', version) } MasterJob [:], { -> - if (game == SKIP) { + def version = params.RELEASE + if (version == SKIP) { currentBuild.result = 'SUCCESS' return } checkout scm + stageWhen("version") { + increaseVersion() + } + stageWhen('build') { - def game = params.GAME - if (game == "all") { - generateOutput("classic_era") - generateOutput("retail") - } else { - generateOutput(game) - } - } - - stageWhen('make release') { - def game = params.GAME + createZipFile("classic_era") + createZipFile("retail") forgejoGit() - if (game == "all") { - createReleaseFile("classic_era") - createReleaseFile("retail") - } else { - createReleaseFile(game) - } + pushToGit() } - stageWhen('upload release') { - def game = params.GAME - def tocFile = tocFiles[game] - def version = readToCVersion(tocFile) - ForgejoRelease('czech-quests', 'addon', version) + stageWhen('release') { + uploadToForgejo() } } \ No newline at end of file