Fix release zip folder structure
This commit is contained in:
parent
d01907381c
commit
d90715c2cc
3 changed files with 57 additions and 63 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
116
Jenkinsfile
vendored
116
Jenkinsfile
vendored
|
@ -7,25 +7,22 @@ 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 output = "Output"
|
||||
def addon = "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 +33,77 @@ def writeToCVersion = { String tocFile, String current, String next ->
|
|||
writeFile(file: tocFile, text: content)
|
||||
}
|
||||
|
||||
def generateOutput = { String 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 increaseVersion = { ->
|
||||
def currentVersion = readToCVersion()
|
||||
def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
|
||||
writeToCVersion(tocFiles['classic_era'], currentVersion, newVersion)
|
||||
writeToCVersion(tocFiles['retail'], currentVersion, newVersion)
|
||||
}
|
||||
|
||||
def createReleaseFile = { String game ->
|
||||
def createZipFile = { String game ->
|
||||
def tocFile = tocFiles[game]
|
||||
def version = readToCVersion()
|
||||
|
||||
// get version
|
||||
def currentVersion = readToCVersion(tocFile)
|
||||
def newVersion = ReleaseUtils.increaseVersion(currentVersion, params.RELEASE)
|
||||
// prepare output folder
|
||||
sh "mkdir -p $output/$addon/Addon/Data"
|
||||
|
||||
// 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
|
||||
def zipFileName = "czech-quests-$game-v${newVersion}.zip"
|
||||
zip zipFile: zipFileName, archive: false, dir: outputFolder
|
||||
def zipFileName = "czech-quests-$game-v${version}.zip"
|
||||
zip zipFile: zipFileName, archive: false, dir: output
|
||||
|
||||
// remove build folder
|
||||
sh "rm -r $outputFolder"
|
||||
sh "rm -r $output"
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue