更新安卓打包jenkins脚本

main
zhangaotian 2024-09-26 16:51:33 +08:00
parent 78a2a6d827
commit 41d34c8f4e
2 changed files with 47 additions and 10 deletions

View File

@ -9,6 +9,7 @@ def CHANNEL_PARAM = params.Channel
def DEBUGBUILD_PARAM = params.DebugBuild
def HOTUPDATE_PARAM = params.Enable_Hot_Update
def AAB_PARAM = params.AAB
def OSS_PARAM = false
// Jenkins
def ARTIFACT_URL = "http://${env.PHXH_BUILDER_IP_ADDRESS}:8080/job/${env.JOB_NAME}/"
@ -80,7 +81,7 @@ pipeline {
log_path="$BUILD_PATH/UpdatePreviousBuild.log"
}
else
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_unity.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM}", returnStatus: true, returnStdout: false)
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_unity.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM} ${OSS_PARAM}", returnStatus: true, returnStdout: false)
//
if(build_result != 0)
@ -99,7 +100,7 @@ pipeline {
SendMessageToWechat(output_exception)
SendMessageToWechat(output_error)
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】构建失败"
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】构建失败"
SendMessageToWechat(message)
error("Failure of the '打包' stage")
}
@ -115,7 +116,7 @@ pipeline {
def upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_rsync.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${CHANNEL_PARAM} ${asset_path} ${upload_path}", returnStatus: true, returnStdout: false)
if(upload_result != 0)
{
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】上传资源失败"
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传资源失败"
SendMessageToWechat(message)
error("Failure of the '上传资源' stage")
}
@ -132,7 +133,7 @@ pipeline {
def upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_rsync.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${CHANNEL_PARAM} ${apk_path} ${upload_path}", returnStatus: true, returnStdout: false)
if(upload_result != 0)
{
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】上传APK失败"
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传APK失败"
SendMessageToWechat(message)
error("Failure of the '上传apk' stage")
}
@ -140,6 +141,23 @@ pipeline {
}
}
}
stage('上传符号表') {
steps {
script {
//
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_symbol_file.sh"
if (params.Build_InitApp == true){
def upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_symbol_file.sh ${VERSION_PARAM} ${PLATFORM_PARAM}", returnStatus: true, returnStdout: false)
if(upload_result != 0)
{
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Debug】【${CHANNEL_PARAM}】上传符号表失败"
SendMessageToWechat(message)
error("Failure of the '上传符号表' stage")
}
}
}
}
}
stage('归档') {
steps {
script {

View File

@ -9,6 +9,7 @@ def CHANNEL_PARAM = params.Channel
def DEBUGBUILD_PARAM = params.DebugBuild
def HOTUPDATE_PARAM = params.Enable_Hot_Update
def AAB_PARAM = params.AAB
def OSS_PARAM = IsOSS()
// Jenkins
def ARTIFACT_URL = "http://${env.PHXH_BUILDER_IP_ADDRESS}:8080/job/${env.JOB_NAME}/"
@ -32,18 +33,18 @@ def GetRemote()
return 'main'
else if('TapTap' == params.Channel)
return 'main'
else if('ReleaseTest' == params.Channel)
return 'main'
else
return 'stable_dev';
}
def IsOSS()
{
if('Official' == params.Channel)
return true;
else if('TapTap' == params.Channel)
return true;
else
if('StableDev' == params.Channel)
return false;
else
return true;
}
pipeline {
@ -65,6 +66,7 @@ pipeline {
}
def remote = GetRemote();
echo "拉取分支:${remote}"
checkout scmGit(branches: [[name: "*/${remote}"]],
extensions: [checkoutOption(600), lfs(), cloneOption(noTags: false, reference: '', shallow: true, timeout: 120), submodule(recursiveSubmodules: true, reference: '', timeout: 1200)],
userRemoteConfigs: [[url: 'http://1.14.122.170:3000/PHXH/NLDClient.git']])
@ -103,7 +105,7 @@ pipeline {
log_path="$BUILD_PATH/UpdatePreviousBuild.log"
}
else
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_unity.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM}", returnStatus: true, returnStdout: false)
build_result=sh(script: "$WORKSPACE/Tool/build_tools/build_unity.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM} ${DEBUGBUILD_PARAM} ${AAB_PARAM} ${OSS_PARAM}", returnStatus: true, returnStdout: false)
//
if(build_result != 0)
@ -174,6 +176,23 @@ pipeline {
}
}
}
stage('上传符号表') {
steps {
script {
//
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_symbol_file.sh"
if (params.Build_InitApp == true){
def upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_symbol_file.sh ${VERSION_PARAM} ${PLATFORM_PARAM}", returnStatus: true, returnStdout: false)
if(upload_result != 0)
{
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】上传符号表失败"
SendMessageToWechat(message)
error("Failure of the '上传符号表' stage")
}
}
}
}
}
stage('归档') {
steps {
script {