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.
362 lines
14 KiB
362 lines
14 KiB
env.build_file_name="_.ipa"
|
|
env.publishChannel="ios"
|
|
env.outpath="/Volumes/volume2/download"
|
|
env.subpath=""
|
|
env.buildUser=""
|
|
env.configFlagLower="en"
|
|
|
|
pipeline
|
|
{
|
|
environment
|
|
{
|
|
PATH="/usr/local/share/dotnet/x64:${PATH}"
|
|
unity_app="/Applications/Unity/Unity.app/Contents/MacOS/Unity"
|
|
sharePath="${WORKSPACE}/pandora_share_proj"
|
|
pandora_cli_proj = "${WORKSPACE}/pandora_cli_proj"
|
|
pandora_pro_dir= "${pandora_cli_proj}/pandora"
|
|
log_dir="${WORKSPACE}/log/ios"
|
|
build_name="pandora_${publishChannel}_${version}_date"
|
|
disableLog="false"
|
|
uselang="en"
|
|
gameIP="111.231.250.180"
|
|
maintenanceIP="111.231.250.180"
|
|
SVN_Credentials=credentials('PANDORA_SVN_TOKEN')
|
|
DistOutputPath="/Volumes/volume2/pandora_ipa"
|
|
}
|
|
|
|
agent {
|
|
node {
|
|
label 'a3_mac_1'
|
|
}
|
|
}
|
|
stages
|
|
{
|
|
stage('InitPyEnv') {
|
|
steps{
|
|
sh label: '',
|
|
script:'''
|
|
|
|
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple psutil
|
|
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
|
|
echo ${WORKSPACE}
|
|
echo $PATH
|
|
'''
|
|
}
|
|
}
|
|
stage('更新cli和share代码')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
echo "My username is $SVN_Credentials_USR"
|
|
|
|
echo "My password is $SVN_Credentials_PSW"
|
|
python3 ./build_ci/u2c/CheckoutShare.py ${Branch} share /usr/local/bin/svn false ${SVN_Credentials_USR} ${SVN_Credentials_PSW}
|
|
python3 ./build_ci/u2c/CheckoutShare.py ${Branch} client /usr/local/bin/svn false ${SVN_Credentials_USR} ${SVN_Credentials_PSW}
|
|
python3 ./build_ci/u2c/CleanSVNUnversioned.py
|
|
'''
|
|
}
|
|
|
|
}
|
|
stage('Set Env Value')
|
|
{
|
|
steps
|
|
{
|
|
script{
|
|
// 设置默认渠道
|
|
env.configFlagLower = config_flag.toLowerCase()
|
|
env.publishChannel = "ios_${configFlagLower}"
|
|
timestamp = new Date().format('yyyyMMddHHmmss')
|
|
// 构建名称
|
|
buid_name = "pandora_${publishChannel}_${version}_${timestamp}"
|
|
echo "$buid_name"
|
|
if ("${debug}" == "true") {
|
|
buid_name = "${buid_name}_debug"
|
|
}
|
|
echo "$buid_name"
|
|
|
|
// 输出文件名
|
|
env.build_file_name = "${buid_name}"
|
|
// if ("${mode}" == "aab") {
|
|
// env.build_file_name = "${buid_name}.aab"
|
|
// }
|
|
env.subpath = "${env.subpath}/${env.publishChannel}/${target}/${version}/${mode}/${timestamp}"
|
|
echo "${env.outpath}"
|
|
env.outpath = "${env.outpath}/${env.subpath}"
|
|
echo "${env.outpath}"
|
|
}
|
|
}
|
|
}
|
|
stage('pre process')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
cd ${WORKSPACE}
|
|
|
|
python3 ./build_ci/cache_files.py ${WORKSPACE} pandora_cli_proj/pandora/ProjectSettings/ProjectSettings.asset tmp/orgin/ProjectSettings.asset tmp/cache/ProjectSettings.asset
|
|
'''
|
|
}
|
|
}
|
|
stage('编译ExcelExcelExpor')
|
|
{
|
|
steps
|
|
{
|
|
script{
|
|
sh """
|
|
echo ${env.PATH}
|
|
cd ${env.sharePath}/ExcelExport
|
|
chmod 774 excelTolua.py
|
|
chmod 774 ExportLanguageToText.py
|
|
python3 ./excelTolua.py region $configFlagLower
|
|
python3 ./ExportLanguageToText.py
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
stage('编译proto')
|
|
{
|
|
steps
|
|
{
|
|
script{
|
|
sh """
|
|
cd ${env.sharePath}/protocol
|
|
chmod 774 export_lua.py
|
|
python3 ./export_lua.py
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
stage('ProcessTextureFormat')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
${unity_app} -quit -batchmode -buildTarget ${target} -projectPath ${pandora_pro_dir} -logFile - -executeMethod XAsset.Build.AssetBuildScript.ProcessTextureFormat graph="Assets/ZXToolkit/AssetGraph/Graph/SpineImageImporter.asset" target=${target}
|
|
'''
|
|
}
|
|
}
|
|
stage('Build')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
cd ${pandora_cli_proj}
|
|
|
|
python3 ${pandora_cli_proj}/../pandora_share_proj/MacBuild/build_generate_common.py debug=${debug} version=${version} disableLog=${disableLog} versionIP="${versionIP}" versionPort=${versionPort} mode=${mode} publishChannel=${publishChannel} gameIP=${gameIP} maintenanceIP=${maintenanceIP} lang=${uselang}
|
|
|
|
echo "use ${configFlagLower} config"
|
|
|
|
python3 ${pandora_cli_proj}/../pandora_share_proj/MacBuild/build_copy_config.py ${config_flag}
|
|
|
|
#占位参数,为了与Android保持一致,ios端不会实际用到
|
|
java_path_placeholder="java_path_placeholder"
|
|
gradle_path_placeholder="gradle_path_placeholder"
|
|
|
|
python3 ${WORKSPACE}/build_ci/parallel_builds.py ${target} \
|
|
${unity_app} \
|
|
${pandora_cli_proj} \
|
|
"${java_path_placeholder}" \
|
|
"${gradle_path_placeholder}" \
|
|
${outpath} \
|
|
${build_file_name} \
|
|
${debug} ${version} ${disableLog} ${versionIP} ${mode} ${publishChannel} ${gameIP} ${maintenanceIP} ${uselang} \
|
|
${isUsingUWATools} ${config_flag} ".." ${useCustomPackagename} ${isUsingUWAPoco} ${thinkingAnalyticsMode}
|
|
'''
|
|
}
|
|
}
|
|
// stage("build libil2cpp.a"){
|
|
// steps{
|
|
// sh label: '',
|
|
// script:'''
|
|
// cd ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/HybridCLRData/iOSBuild
|
|
// if [ -f "${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/HybridCLRData/iOSBuild/build" ]; then
|
|
// rm -rf "${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/HybridCLRData/iOSBuild/build"
|
|
// fi
|
|
// dos2unix build_libil2cpp.sh
|
|
// dos2unix gen_lump.sh
|
|
// chmod 774 build_libil2cpp.sh
|
|
// chmod 774 gen_lump.sh
|
|
// ./build_libil2cpp.sh
|
|
// cp "${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/HybridCLRData/iOSBuild/build/libil2cpp.a" "${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject/Libraries"
|
|
// '''
|
|
// }
|
|
// }
|
|
stage("copy custom files"){
|
|
steps{
|
|
sh label: '',
|
|
script:'''
|
|
copy() {
|
|
local source=$1
|
|
local target=$2
|
|
|
|
if [ -f $source ]; then
|
|
cp "$source" "$target"
|
|
elif [ -d $source ]; then
|
|
mkdir -p "$target"
|
|
for item in "$source"/*
|
|
do
|
|
copy "$item" "$target/${item##*/}"
|
|
done
|
|
fi
|
|
}
|
|
|
|
copy_files() {
|
|
local source=$1
|
|
local target=$2
|
|
|
|
copy "$source" "$target"
|
|
}
|
|
copy_files "${WORKSPACE}/iOS/${config_flag}" "${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject"
|
|
'''
|
|
}
|
|
}
|
|
stage('DS')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
/usr/libexec/PlistBuddy -c 'Set:CFBundleShortVersionString "1.0.'${BundleVersion}'"' ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Set:CFBundleVersion "'${BundleVersion}'"' ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Set:CFBundleIdentifier "'${BundleID}'"' ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Set:CFBundleDisplayName '"${BundleNAME}"'' ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject/Info.plist
|
|
cd ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject
|
|
xcodebuild clean -alltargets
|
|
echo $PATH
|
|
|
|
hero-pack -config ${WORKSPACE}/iOS_Config/${config_flag}/${JOB_BASE_NAME}/packConfig.json
|
|
'''
|
|
}
|
|
}
|
|
stage('post process')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
cd ${WORKSPACE}
|
|
|
|
python3 ./build_ci/cache_files.py ${WORKSPACE} pandora_cli_proj/pandora/ProjectSettings/ProjectSettings.asset tmp/orgin/ProjectSettings.asset tmp/cache/ProjectSettings.asset true
|
|
'''
|
|
}
|
|
}
|
|
stage('CopyIpa')
|
|
{
|
|
steps
|
|
{
|
|
sh label: '',
|
|
script:'''
|
|
DistOutputPath=${DistOutputPath}/${JOB_BASE_NAME}
|
|
echo "$DistOutputPath"
|
|
|
|
cd ${DistOutputPath}
|
|
latest_folder=$(ls -t1 | head -n1)
|
|
if [ ! -f "${DistOutputPath}/${latest_folder}/ChestQuestMiniRPG.ipa" ]; then
|
|
echo "dev文件不存在"
|
|
exit 1
|
|
fi
|
|
cp -n "${DistOutputPath}/${latest_folder}/ChestQuestMiniRPG.ipa" "/Volumes/volume1/docker_nginx/html/${config_flag}/${build_file_name}_dev.ipa"
|
|
rm -f "${DistOutputPath}/${latest_folder}/ChestQuestMiniRPG.ipa"
|
|
if [ ! -f "${DistOutputPath}/${latest_folder}/dis/ChestQuestMiniRPG.ipa" ]; then
|
|
echo "dis文件不存在"
|
|
exit 1
|
|
fi
|
|
cp -n "${DistOutputPath}/${latest_folder}/dis/ChestQuestMiniRPG.ipa" "/Volumes/volume1/docker_nginx/html/${config_flag}/${build_file_name}_dis.ipa"
|
|
rm -f "${DistOutputPath}/${latest_folder}/dis/ChestQuestMiniRPG.ipa"
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
post
|
|
{
|
|
success
|
|
{
|
|
wrap([$class: 'BuildUser']) {
|
|
script {
|
|
env.buildUser = "${env.BUILD_USER}"
|
|
}
|
|
buildName "#${env.BUILD_NUMBER} ---> ${version}"
|
|
buildDescription "<a href=\"http://10.0.23.156:7982/${env.config_flag}/${env.build_file_name}_dev.ipa\">点击下载: pandora_${version}_dev</a>\n \
|
|
<a href=\"http://10.0.23.156:7982/${env.config_flag}/${env.build_file_name}_dis.ipa\">点击下载: pandora_${version}_dis</a>"
|
|
|
|
}
|
|
sh label: '',
|
|
script:'''
|
|
curl -X POST -H "Content-Type: application/json" -d \
|
|
'{
|
|
"msg_type": "interactive",
|
|
"card": {
|
|
"elements":
|
|
[{
|
|
"tag": "div",
|
|
"text": {
|
|
"content": "构建者:'$buildUser'",
|
|
"tag": "lark_md"
|
|
}
|
|
},
|
|
{
|
|
"tag": "div",
|
|
"text": {
|
|
"content": "分支:'$Branch'",
|
|
"tag": "lark_md"
|
|
}
|
|
},
|
|
{
|
|
"actions": [{
|
|
"tag": "button",
|
|
"text": {
|
|
"content": "'$build_file_name'_dev.ipa",
|
|
"tag": "lark_md"
|
|
},
|
|
"url": "http://10.0.23.156:7982/'$config_flag'/'$build_file_name'_dev.ipa",
|
|
"type": "default",
|
|
"value": {}
|
|
}],
|
|
"tag": "action"
|
|
},
|
|
{
|
|
"actions": [{
|
|
"tag": "button",
|
|
"text": {
|
|
"content": "'$build_file_name'_dis.ipa",
|
|
"tag": "lark_md"
|
|
},
|
|
"url": "http://10.0.23.156:7982/'$config_flag'/'$build_file_name'_dis.ipa",
|
|
"type": "default",
|
|
"value": {}
|
|
}],
|
|
"tag": "action"
|
|
}],
|
|
"header": {
|
|
"title": {
|
|
"content": "'$config_flag'-'$mode'",
|
|
"tag": "plain_text"
|
|
}
|
|
}
|
|
}
|
|
} ' \
|
|
https://open.feishu.cn/open-apis/bot/v2/hook/8d1b6a92-fd8c-4c58-9e81-b2912ee1a641
|
|
'''
|
|
//sh label: '', script: """sh ${env.u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} SUCCESS ${env.JOB_NAME} apk"""
|
|
|
|
}
|
|
failure
|
|
{
|
|
wrap([$class: 'BuildUser']) {
|
|
script {
|
|
env.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"
|
|
}
|
|
}
|
|
}
|
|
|
|
|