rsemcs/Jenkinsfile

50 lines
2.2 KiB
Groovy

pipeline {
agent {
label 'increased_mem'
}
options {
disableConcurrentBuilds()
}
stages {
stage("run server") {
when {
not {
triggeredBy "BuildUpstreamCause"
}
}
steps {
fileOperations([fileCreateOperation(fileContent: 'eula=true', fileName: 'eula.txt')])
fileOperations([fileDownloadOperation(password: '', proxyHost: '', proxyPort: '', targetFileName: 'DynmapBlockScan.jar', targetLocation: 'mods/', url: 'https://github.com/webbukkit/DynmapBlockScan/releases/download/v3.4-beta-1/DynmapBlockScan-3.4-beta-1-forge-1.18.jar', userName: '')])
pwsh returnStatus: true, script: 'echo "stop" | java -Xmx4G @libraries/net/minecraftforge/forge/1.18.2-40.1.19/unix_args.txt'
logParser failBuildOnError: true, projectRulePath: 'Jenkinsparse', parsingRulesPath: 'Jenkinsparse', showGraphs: true, unstableOnWarning: true, useProjectRule: true
fileOperations([fileDeleteOperation(excludes: '', includes: 'mods/DynmapBlockScan.jar')])
}
}
stage("cleanup") {
when {
not {
triggeredBy "BuildUpstreamCause"
}
}
steps {
pwsh "git clean -dfX"
fileOperations([folderDeleteOperation('world')])
}
}
stage("deploy") {
when {
branch '**/master'
}
steps {
sshagent(['ce4c701d-098c-4706-8f32-c0af996a7769']) {
pwsh "ssh -o StrictHostKeyChecking=no gamehost@entertainment 'systemctl --user stop rsemcs'"
pwsh "rsync -a --update --exclude ./mods/ --exclude ./config/ ./** gamehost@entertainment:/home/gamehost/mcserver/"
pwsh "rsync -a --update --delete ./mods/ gamehost@entertainment:/home/gamehost/mcserver/mods"
pwsh "rsync -a --update --delete --exclude '*.json' ./* gamehost@entertainment:/home/gamehost/mcserver/"
pwsh "ssh gamehost@entertainment 'systemctl --user start rsemcs'"
}
}
}
}
}