Remove GAME parameter from Jenkins and set same versions
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good

This commit is contained in:
Roman Jaroš 2025-03-08 16:16:16 +01:00
parent d01907381c
commit ce3d4ed426
3 changed files with 43 additions and 54 deletions

View file

@ -2,7 +2,7 @@
## Title: CzechQuests ## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language ## Notes: Addon displays texts of quests in Czech language
## Author: Roman Jaroš ## Author: Roman Jaroš
## Version: 0.2.14 ## Version: 1.0.0
## SavedVariables: CzechQuestsAddon_Store ## SavedVariables: CzechQuestsAddon_Store
## Category: Translations ## Category: Translations
## IconTexture: Interface\AddOns\CzechQuests\Assets\Icons\Logo ## IconTexture: Interface\AddOns\CzechQuests\Assets\Icons\Logo

View file

@ -2,7 +2,7 @@
## Title: CzechQuests ## Title: CzechQuests
## Notes: Addon displays texts of quests in Czech language as tooltip ## Notes: Addon displays texts of quests in Czech language as tooltip
## Author: Roman Jaroš ## Author: Roman Jaroš
## Version: 0.1.13 ## Version: 1.0.0
## SavedVariables: CzechQuestsAddon_Store ## SavedVariables: CzechQuestsAddon_Store
CzechQuests.lua CzechQuests.lua

93
Jenkinsfile vendored
View file

@ -7,25 +7,21 @@ def SKIP = "skip"
properties([parameters([ properties([parameters([
choice( choice(
name: 'RELEASE', name: 'RELEASE',
choices: ['patch', 'minor', 'major'], choices: [SKIP, 'patch', 'minor', 'major'],
description: 'Release new version' description: 'Next new version'
), ),
choice(
name: 'GAME',
choices: [SKIP, 'classic_era', 'retail', 'all'],
description: 'Create build with manual tag',
)
])]) ])])
def outputFolder = "CzechQuests" def outputFolder = "CzechQuests"
def tocFiles = [ def tocFiles = [
"classic_era": "CzechQuests_Vanilla.toc", "classic_era": "CzechQuests_Vanilla.toc",
"retail" : "CzechQuests_Mainline.toc" "retail" : "CzechQuests_Mainline.toc"
] ]
def readToCVersion = { String tocFile -> def readToCVersion = { ->
return sh( return sh(
script: "grep '## Version:' $tocFile | cut -d ' ' -f 3", script: "grep '## Version:' ${tocFiles['classic_era']} | cut -d ' ' -f 3",
returnStdout: true returnStdout: true
).trim() ).trim()
} }
@ -36,80 +32,73 @@ def writeToCVersion = { String tocFile, String current, String next ->
writeFile(file: tocFile, text: content) 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, "v$newVersion")
writeToCVersion(tocFiles['retail'], currentVersion, "v$newVersion")
}
def createZipFile = { String game ->
def tocFile = tocFiles[game]
def version = readToCVersion()
// prepare output folder // prepare output folder
sh "mkdir -p $outputFolder" sh "mkdir -p $outputFolder"
// copy toc file // copy toc file
def tocFile = tocFiles[game]
sh "cp $tocFile $outputFolder" sh "cp $tocFile $outputFolder"
// copy files // copy files
sh "find . -name '*.lua' -exec rsync -av {} $outputFolder \\;" sh "find . -name '*.lua' -exec rsync -av {} $outputFolder \\;"
sh "find . -name '*.tga' -exec rsync -av {} $outputFolder \\;" sh "find . -name '*.tga' -exec rsync -av {} $outputFolder \\;"
sh "find . -name '*.ttf' -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 // 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 zip zipFile: zipFileName, archive: false, dir: outputFolder
// remove build folder // remove build folder
sh "rm -r $outputFolder" sh "rm -r $outputFolder"
}
// save version def pushToGit = { ->
writeToCVersion(tocFile, currentVersion, newVersion) def version = readToCVersion()
def tag = "v$version"
// commit new version
def tag = "v$newVersion"
sh "git checkout ${BRANCH_NAME}" sh "git checkout ${BRANCH_NAME}"
sh "git add $tocFile" sh "git add *.toc"
sh "git commit -m 'Release ${tag}'" sh "git commit -m 'Release $tag'"
sh "git push" sh "git push"
sh "git tag ${tag}" sh "git tag $tag"
sh "git push origin ${tag}" sh "git push origin $tag"
}
def uploadToForgejo = { ->
def version = readToCVersion()
ForgejoRelease('czech-quests', 'addon', version)
} }
MasterJob [:], { -> MasterJob [:], { ->
if (game == SKIP) { def version = params.RELEASE
if (version == SKIP) {
currentBuild.result = 'SUCCESS' currentBuild.result = 'SUCCESS'
return return
} }
checkout scm checkout scm
stageWhen("version") {
increaseVersion()
}
stageWhen('build') { stageWhen('build') {
def game = params.GAME createZipFile("classic_era")
if (game == "all") { createZipFile("retail")
generateOutput("classic_era")
generateOutput("retail")
} else {
generateOutput(game)
}
}
stageWhen('make release') {
def game = params.GAME
forgejoGit() forgejoGit()
if (game == "all") { pushToGit()
createReleaseFile("classic_era")
createReleaseFile("retail")
} else {
createReleaseFile(game)
}
} }
stageWhen('upload release') { stageWhen('release') {
def game = params.GAME uploadToForgejo()
def tocFile = tocFiles[game]
def version = readToCVersion(tocFile)
ForgejoRelease('czech-quests', 'addon', version)
} }
} }