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 = "main"; 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 { // 需要用到dll_tools下的脚本 // revert_and_pull_git.sh // 先给权限 sh "chmod +x $WORKSPACE/Tool/dll_tools/*" sh "cd $WORKSPACE/Tool/dll_tools && ./revert_and_pull_git.sh" } } stage('设置环境') { steps { // 将打包机器相关配置复制到打包路径下 echo "copy local env file to $WORKSPACE" sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/dll_tools/" } } stage('打开unity工程') { steps { // 需要用到dll_tools下的脚本 // open_unity.sh // 先给权限 sh "chmod +x $WORKSPACE/Tool/dll_tools/*" // 打开unity工程 sh "cd $WORKSPACE/Tool/dll_tools && ./open_unity.sh" } } stage('上传dll') { steps { // 先给权限 sh "chmod +x $WORKSPACE/Tool/dll_tools/*" // 执行自动上传dll脚本 sh "cd $WORKSPACE/Tool/dll_tools && ./auto_upload_dll.sh GamePlay" // 执行上传脚本 sh "cd $WORKSPACE/Tool/dll_tools && ./push_to_git.sh" } } } }