You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
354 lines
14 KiB
354 lines
14 KiB
env.build_file_name="_.apk"
|
|
env.publishChannel=""
|
|
env.outpath="D:/DockerContainer/nginx/www"
|
|
env.subpath=""
|
|
env.buildUser=""
|
|
|
|
pipeline
|
|
{
|
|
environment
|
|
{
|
|
unity_app="C:/Application/Unity2022.3.14f1/Editor/Unity.exe"
|
|
sharePath="${WORKSPACE}/trunk/share"
|
|
pandora_cli_proj = "${WORKSPACE}/trunk/client"
|
|
pandora_pro_dir= "${pandora_cli_proj}/client"
|
|
log_dir="${WORKSPACE}/log/android"
|
|
build_name="pandora_${publishChannel}_${version}_date"
|
|
disableLog="${disableLog}"
|
|
lang="en"
|
|
gameIP="111.231.250.180"
|
|
maintenanceIP="111.231.250.180"
|
|
SVN_Credentials=credentials('2H_SVN_TOKEN')
|
|
wxMiniGame_toolPath='"C:/Application/WxDevelopTool/"'
|
|
privateKey_path = "./private.wx20c79f85101be00a.key"
|
|
target_Path = "${WORKSPACE}\\..\\..\\build"
|
|
// feshu_url="8d1b6a92-fd8c-4c58-9e81-b2912ee1a641"
|
|
}
|
|
|
|
agent {
|
|
node {
|
|
label 'windows_1'
|
|
}
|
|
}
|
|
options{
|
|
timestamps()
|
|
}
|
|
stages
|
|
{
|
|
stage('InitPyEnv') {
|
|
steps{
|
|
bat label: '',
|
|
script:'''
|
|
java -version
|
|
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple psutil
|
|
python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
|
|
python -m pip install -i https://pypi.douban.com/simple xlrd==1.2.0
|
|
|
|
'''
|
|
}
|
|
}
|
|
stage('更新cli和share代码')
|
|
{
|
|
steps
|
|
{
|
|
bat label: '',
|
|
script:'''
|
|
cd /D %WORKSPACE%
|
|
python ./build_ci/u2c/CheckoutShare.py %Branch% all D:/soft/Apache-Subversion-1.10.3/bin/svn.exe false %SVN_Credentials_USR% %SVN_Credentials_PSW%
|
|
rem python ./build_ci/u2c/CleanSVNUnversioned.py
|
|
'''
|
|
}
|
|
}
|
|
stage('替换WxContext文件Context文件') {
|
|
steps {
|
|
script {
|
|
def filePath = "${pandora_cli_proj}/client/Assets/WX-WASM-SDK-V2/Runtime/WxContext.cs"
|
|
def templateContent = """
|
|
namespace WeChatWASM
|
|
{
|
|
public class WxContext
|
|
{
|
|
public const string CDN = "${CDN_URL}${CDN_SUB_PATH}/";
|
|
}
|
|
}
|
|
"""
|
|
writeFile(file: filePath, text: templateContent.trim())
|
|
echo "WxContext文件已写入到 ${filePath}."
|
|
|
|
def contextFilePath = "${pandora_cli_proj}/client/Assets/Scripts/UI/Const/Context.cs"
|
|
def contextTemplateContent = """
|
|
namespace GM
|
|
{
|
|
public static class Context
|
|
{
|
|
public static string[] versionIPs = new string[] { "${VERSION_SERVER}" };
|
|
public static int versionPort = ${VERSION_SERVER_PORT};
|
|
public static string gameIP = "anhei-xcx-websocket.zealshow.com";
|
|
// public static int gamePort = 49720;
|
|
public static int gamePort = 9720;
|
|
public static string maintenanceIP = "panduola-xcx-websocket.shyxhy.com";
|
|
public static string buildMode = "apk";
|
|
public static string lang = "en";
|
|
public static string appVersion = "${Version}";
|
|
public static string publishChannel = "google_oversea";
|
|
public static string connectLobbyIP = gameIP;
|
|
}
|
|
}
|
|
"""
|
|
writeFile(file: contextFilePath, text: contextTemplateContent.trim())
|
|
echo "Context文件已写入到 ${contextFilePath}."
|
|
}
|
|
}
|
|
}
|
|
stage('编译ExcelExcel 和 pb')
|
|
{
|
|
steps
|
|
{
|
|
bat label: '',
|
|
script:'''
|
|
CHCP 65001
|
|
|
|
echo %sharePath%
|
|
|
|
cd %sharePath%/protocol
|
|
call gen.bat nopause
|
|
cd %sharePath%/protocol_cli
|
|
call update_client_proto_no_pause.bat
|
|
|
|
cd %sharePath%/ExcelExport
|
|
|
|
python ExportLanguageToText.py
|
|
call run_SpeedWin.bat nopause
|
|
'''
|
|
}
|
|
}
|
|
stage('ProcessTextureFormat')
|
|
{
|
|
steps
|
|
{
|
|
bat label: '',
|
|
script:'''
|
|
%unity_app% -quit -batchmode -buildTarget %target% -projectPath %pandora_pro_dir% -logFile - -executeMethod XAsset.Build.AssetBuildScript.ProcessTextureFormat graph=Assets/ZXToolkit/AssetGraph/Graph/ChangeTextFormat.asset target=%target%
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('BuildAsset')
|
|
{
|
|
steps
|
|
{
|
|
bat label: '',
|
|
script:'''
|
|
%unity_app% -quit -batchmode -buildTarget %target% -projectPath %pandora_pro_dir% -logFile - -executeMethod XAsset.Build.AssetBuildScript.RunBuild graph=Assets/ZXToolkit/AssetGraph/Graph/BuildAssets.asset target=%target% version=%Version% debug=%DEVELOPMENT_BUILD%
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage("并行阶段 <Upload Cdn, ExportMiniGame>"){
|
|
parallel{
|
|
stage('Upload Cdn'){
|
|
steps
|
|
{
|
|
bat label:'',
|
|
script:'''
|
|
cd /D %WORKSPACE%/2h/wx_debug/
|
|
echo %Version%
|
|
python ./UploadCDN.py %Version% %pandora_pro_dir% %CDN_SUB_PATH% %CDN_URL% %UploadRefresh_VersionFile%
|
|
'''
|
|
}
|
|
}
|
|
stage('Export MiniGame')
|
|
{
|
|
steps
|
|
{
|
|
bat label: '',
|
|
script:'''
|
|
cd /D %WORKSPACE%/2h/wx_debug/
|
|
echo %RELEASE_DEFINE_SYMBOL%
|
|
python ./ExportWxMiniGame.py %unity_app% %pandora_pro_dir% %RELEASE_DEFINE_SYMBOL% %DEVELOPMENT_BUILD% %CDN_URL%%CDN_SUB_PATH% %WORKSPACE%/Mini %Version%
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('上传wasm') {
|
|
steps{
|
|
bat label:'',
|
|
script:'''
|
|
cd /D %WORKSPACE%/2h/wx_debug/
|
|
python ./UploadWasm.py %Version% %WORKSPACE%/Mini %CDN_SUB_PATH%
|
|
'''
|
|
}
|
|
}
|
|
stage('上传与预览') {
|
|
steps{
|
|
script {
|
|
// 执行命令并获取返回码
|
|
def exitCode = bat returnStatus: true, script: """
|
|
cd /D %WORKSPACE%/2h/wx_debug/
|
|
%wxMiniGame_toolPath%node.exe ./PreviewAndUpload.js %WORKSPACE%/Mini/minigame %privateKey_path% %Version% %RobatId%
|
|
echo %WORKSPACE%/2h/wx_debug/%Version%.destination.jpg
|
|
copy "${WORKSPACE}\\2h\\wx_debug\\${Version}.destination.jpg" "${target_Path}\\${Version}.destination.jpg"
|
|
"""
|
|
|
|
// 检查返回码,如果非0,则抛出异常,退出stage
|
|
if (exitCode != 0) {
|
|
error "上传与预览,返回码:${exitCode}"
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
// stage('Build')
|
|
// {
|
|
// steps
|
|
// {
|
|
// bat label: '',
|
|
// script:'''
|
|
// cd /D %pandora_cli_proj%
|
|
|
|
// python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_generate_common.py debug=%debug% version=%version% disableLog=%disableLog% versionIP="%versionIP%" mode=%mode% publishChannel=%publishChannel% gameIP=%gameIP% maintenanceIP=%maintenanceIP% lang=%lang% versionPort=%versionPort%
|
|
|
|
// if "%config_flag%"=="JP" (
|
|
// echo "use japan config"
|
|
// python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py JP
|
|
// )
|
|
|
|
// if "%config_flag%"=="KR" (
|
|
// echo "use japan config"
|
|
// python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py KR
|
|
// )
|
|
|
|
// if "%config_flag%"=="SEA" (
|
|
// echo "use SoutheastAsia config"
|
|
// python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py SEA
|
|
// )
|
|
// if "%config_flag%"=="ZH" (
|
|
// echo "use ZH config"
|
|
// python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py ZH
|
|
// )
|
|
// if "%config_flag%"=="EN" (
|
|
// echo "use EN config"
|
|
// python %pandora_cli_proj%/../pandora_share_proj/MacBuild/build_copy_config.py EN
|
|
// )
|
|
// cd /D %WORKSPACE%
|
|
// python ./build_ci/parallel_builds.py %target% \
|
|
// %unity_app% \
|
|
// %pandora_cli_proj% \
|
|
// "C:/Program Files/Java/jdk1.8.0_361/bin/java.exe" \
|
|
// "C:/Application/Unity2019.4.26f1c1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" \
|
|
// %outpath% \
|
|
// %build_file_name% \
|
|
// %debug% %version% %disableLog% %versionIP% %mode% %publishChannel% %gameIP% %maintenanceIP% %lang% \
|
|
// %isUsingUWATools% %config_flag% ".." %useCustomPackagename% %isUsingUWAPoco% %thinkingAnalyticsMode%
|
|
// if not exist %outpath%/%build_file_name% (
|
|
// echo "apk or aab not exist"
|
|
// exit /b 1
|
|
// )
|
|
// '''
|
|
// }
|
|
// }
|
|
// stage('ProcessAabNoSplitRes')
|
|
// {
|
|
// steps
|
|
// {
|
|
// bat label: '',
|
|
// script:'''
|
|
// if "%mode%"=="aab" (
|
|
// echo "process aab"
|
|
// %unity_app% -quit -batchmode -buildTarget %target% -projectPath %pandora_pro_dir% -logFile - -executeMethod XAsset.Build.AssetBuildScript.ProcessAabNoSplitRes graph=Assets/ZXToolkit/AssetGraph/Graph/BuildGraph_Aab_PostProcess.asset target=$target$ outpath=%outpath%/%build_file_name%
|
|
// )
|
|
// '''
|
|
// }
|
|
// }
|
|
// stage('post process')
|
|
// {
|
|
// steps
|
|
// {
|
|
// bat label: '',
|
|
// script:'''
|
|
// cd /D %WORKSPACE%
|
|
|
|
// python ./build_ci/cache_files.py %WORKSPACE% pandora_cli_proj/pandora/ProjectSettings/ProjectSettings.asset tmp/orgin/ProjectSettings.asset tmp/cache/ProjectSettings.asset true
|
|
// '''
|
|
// }
|
|
// }
|
|
}
|
|
post
|
|
{
|
|
success
|
|
{
|
|
wrap([$class: 'BuildUser']) {
|
|
script {
|
|
buildUser = "${env.BUILD_USER}"
|
|
}
|
|
// buildDescription "<img src="" alt="预览二维码" width="200" height="200" />"
|
|
|
|
}
|
|
script {
|
|
def fileName = "${Version}.destination.jpg"
|
|
currentBuild.description = """
|
|
<div style="display: flex;justify-content: center;">
|
|
<img src="http://10.0.22.46:8001/${fileName}" alt="预览二维码" width="200" height="200" />
|
|
</div>
|
|
"""
|
|
}
|
|
bat label: '', script: """
|
|
cd /D %WORKSPACE%/2h/wx_debug/
|
|
python NoticeToFeishu.py %Version% true
|
|
"""
|
|
//sh label: '', script: """sh ${env.u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} SUCCESS ${env.JOB_NAME} apk"""
|
|
|
|
}
|
|
failure
|
|
{
|
|
wrap([$class: 'BuildUser']) {
|
|
script {
|
|
buildUser = "${env.BUILD_USER}"
|
|
}
|
|
}
|
|
//sh label: '', script: """sh ${env.u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} FAILURE ${env.JOB_NAME} apk"""
|
|
echo "FAILURE"
|
|
bat label: '', script: """
|
|
cd /D %WORKSPACE%/2h/wx_debug/
|
|
python NoticeToFeishu.py %Version% false
|
|
"""
|
|
}
|
|
}
|
|
// post
|
|
// {
|
|
// success
|
|
// {
|
|
// wrap([$class: 'BuildUser']) {
|
|
// script {
|
|
// env.buildUser = "${BUILD_USER}"
|
|
// }
|
|
// }
|
|
// buildName "#${BUILD_NUMBER} ---> ${version}"
|
|
// buildDescription "<a href=\"http://10.0.23.47:7980/${env.subpath}/${env.build_file_name}\">点击下载: pandora_${version}</a>"
|
|
// //sh label: '', script: """sh ${u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} SUCCESS ${JOB_NAME} apk"""
|
|
// bat label: '',
|
|
// script:'''
|
|
// "C:/Program Files/Git/bin/sh.exe" %WORKSPACE%/build_ci/u2c/feishu_buildPackage.sh %buildUser% %Branch% SUCCESS "%config_flag%-%mode%" %build_file_name% %subpath% %feshu_url%
|
|
// '''
|
|
|
|
// }
|
|
// failure
|
|
// {
|
|
// wrap([$class: 'BuildUser']) {
|
|
// script {
|
|
// env.buildUser = "${BUILD_USER}"
|
|
// echo "FAILURE"
|
|
// }
|
|
// }
|
|
// //sh label: '', script: """sh ${u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} FAILURE ${JOB_NAME} apk"""
|
|
// bat label: '',
|
|
// script:'''
|
|
// "C:/Program Files/Git/bin/sh.exe" %WORKSPACE%/build_ci/u2c/feishu_buildPackage.sh %buildUser% %Branch% FAILURE "%config_flag%-%mode%" %build_file_name% %subpath% %feshu_url%
|
|
// '''
|
|
// }
|
|
// }
|
|
}
|
|
|
|
|