Fix release zip folder structure

This commit is contained in:
Roman Jaroš 2025-03-08 16:16:16 +01:00
parent d01907381c
commit d90715c2cc
3 changed files with 57 additions and 63 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

116
Jenkinsfile vendored
View file

@ -7,25 +7,22 @@ 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 output = "Output"
def addon = "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 +33,77 @@ def writeToCVersion = { String tocFile, String current, String next ->
writeFile(file: tocFile, text: content) writeFile(file: tocFile, text: content)
} }
def generateOutput = { String game -> def increaseVersion = { ->
// prepare output folder def currentVersion = readToCVersion()
sh "mkdir -p $outputFolder" def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
writeToCVersion(tocFiles['classic_era'], currentVersion, newVersion)
// copy toc file writeToCVersion(tocFiles['retail'], currentVersion, newVersion)
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 createZipFile = { String game ->
def tocFile = tocFiles[game] def tocFile = tocFiles[game]
def version = readToCVersion()
// get version // prepare output folder
def currentVersion = readToCVersion(tocFile) sh "mkdir -p $output/$addon/Addon/Data"
def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
// copy toc file
sh "cp $tocFile $output/$addon"
// copy lue files
sh "rsync -av './CzechQuests.lua' ./$output/$addon"
sh "rsync -av './Addon/Data/other.lua' ./$output/$addon/Addon/Data"
sh "find ./Addon/Data/$game/ -name '*.lua' -exec rsync -av {} ./$output/$addon/Addon/Data/ \\;"
sh "find ./Addon/Code/ -name '*.lua' -exec rsync -av {} ./$output/$addon/Addon/Code/ \\;"
// copy assets
sh "find . -name '*.tga' -exec rsync -avR {} $output/$addon \\;"
sh "find . -name '*.ttf' -exec rsync -avR {} $output/$addon \\;"
// 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: output
// remove build folder // remove build folder
sh "rm -r $outputFolder" sh "rm -r $output"
}
// save version def pushToGit = { ->
writeToCVersion(tocFile, currentVersion, newVersion) def version = readToCVersion()
// 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 $version'"
sh "git push" sh "git push"
sh "git tag ${tag}" sh "git tag $version"
sh "git push origin ${tag}" sh "git push origin $version"
}
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)
} }
} }