NLDClient-yudde/Tool/dll_tools/command.groovy

60 lines
2.6 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

pipeline {
agent any
stages {
stage('拉最新工程') {
steps {
script {
def currentPath = sh(script: 'pwd', returnStdout: true).trim()
echo "cd ${currentPath}"
// 如果仓库存在及还原脚本存在,进行子模块还原
def gitDirExists = sh(script: '[ -d ".git" ] && echo "true" || echo "false"', returnStdout: true).trim()
def scriptPathExists = fileExists("${WORKSPACE}/Tool/build_tools/git_revert_modules_modification.sh")
if (gitDirExists == 'true' && scriptPathExists)
{
sh "chmod +x $WORKSPACE/Tool/build_tools/git_revert_modules_modification.sh"
sh "$WORKSPACE/Tool/build_tools/git_revert_modules_modification.sh $WORKSPACE"
}
def remote = GetRemote();
echo "拉取分支:${remote}"
checkout scmGit(branches: [[name: "*/${remote}"]],
extensions: [checkoutOption(60), lfs(), cloneOption(noTags: false, reference: '', shallow: false, timeout: 120), submodule(recursiveSubmodules: true, reference: '', timeout: 1200)],
userRemoteConfigs: [[url: 'http://1.14.122.170:3000/PHXH/NLDClient.git']])
}
}
}
stage('设置环境') {
steps {
// 将打包机器相关配置复制到打包路径下
echo "copy local env file to $WORKSPACE"
sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/build_tools/"
}
}
stage('打开unity工程') {
steps {
// 需要用到dll_tools下的脚本
// open_unity.sh
// auto_upload_dll.sh
// auto_upload_dll.sh 需要传入参数dllName
// push_to_git.sh
// 先给权限
sh "chmod +x $WORKSPACE/Tool/build_tools/dll_tools/*"
// 打开unity工程
sh "cd $WORKSPACE/Tool/dll_tools && ./open_unity.sh"
// 等待unity打开
sleep 10
// 执行自动上传dll脚本
sh "cd $WORKSPACE/Tool/dll_tools && ./auto_upload_dll.sh GamePlay"
// 等待上传完成
sleep 10
// 执行上传脚本
sh "cd $WORKSPACE/Tool/dll_tools && ./push_to_git.sh"
}
}
}
}