jenkins-scripts/predeploy/Jenkinsfile

23 lines
696 B
Groovy

stage ('predeploy') {
echo 'checking tag'
script {
def tag = sh(returnStdout: true, script: "git tag --contains").trim()
if (tag) {
echo 'found tag ' + tag
def tagNoV = tag.substring(1)
sh "cd ${TARGET_FOLDER} ; echo 'mkdir ${tagNoV}; mv ./master/* ./${tagNoV}; rm -r -d ./master; rm ${DEPLOY_VERSION_SH}' > ${DEPLOY_VERSION_SH}"
} else {
echo 'tag not found'
sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_SH}' > ${DEPLOY_VERSION_SH}"
}
}
}
stage ('archiving') {
// Archive the build output artifacts.
script {
archiveArtifacts artifacts: "${TARGET_FOLDER}/*"
}
}