Fix release both game version
Some checks failed
forgejo/Czech Quests/addon/pipeline/head There was a failure building this commit

This commit is contained in:
Roman Jaroš 2025-03-08 15:58:27 +01:00
parent 84ee045c98
commit 618276c269

43
Jenkinsfile vendored
View file

@ -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)