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 49886484e1
3 changed files with 30 additions and 46 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

72
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: 'Release 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,25 +32,22 @@ def writeToCVersion = { String tocFile, String current, String next ->
writeFile(file: tocFile, text: content) writeFile(file: tocFile, text: content)
} }
def generateOutput = { String game -> def createZipFile = { String game ->
def tocFile = tocFiles[game]
// 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 // get version
def currentVersion = readToCVersion(tocFile) def currentVersion = readToCVersion()
def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE) def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
// create zip // create zip
@ -66,19 +59,27 @@ def createReleaseFile = { String game ->
// save version // save version
writeToCVersion(tocFile, currentVersion, newVersion) writeToCVersion(tocFile, currentVersion, newVersion)
}
// commit new version def pushToGit = { ->
def tag = "v$newVersion" def version = readToCVersion()
def tag = "v$version"
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
} }
@ -86,30 +87,13 @@ MasterJob [:], { ->
checkout scm checkout scm
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)
} }
} }