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.
381 lines
14 KiB
381 lines
14 KiB
env.build_file_name="_.ipa"
|
|
env.publishChannel=""
|
|
env.outpath="/Volumes/volume2/download"
|
|
env.subpath=""
|
|
env.buildUser=""
|
|
env.configFlagLower="jp"
|
|
env.DistOutputPath="/Volumes/volume2/pandora_ipa"
|
|
|
|
pipeline
|
|
{
|
|
environment
|
|
{
|
|
PATH="/usr/local/share/dotnet/x64:/usr/local/bin:${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"
|
|
build_graph="Assets/ZXToolkit/AssetGraph/Graph/BuildGraph.asset"
|
|
log_dir="${WORKSPACE}/log/ios"
|
|
buid_name="pandora_${publishChannel}_${version}_date"
|
|
disableLog="false"
|
|
uselang="en"
|
|
gameIP="111.231.250.180"
|
|
maintenanceIP="111.231.250.180"
|
|
feshu_url="8d1b6a92-fd8c-4c58-9e81-b2912ee1a641"
|
|
// SVN_Credentials=credentials('PANDORA_SVN_TOKEN')
|
|
}
|
|
|
|
agent {
|
|
node {
|
|
label 'mac'
|
|
}
|
|
}
|
|
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:'''
|
|
python3 ./build_ci/u2c/CheckoutShare.py ${Branch} share /usr/local/bin/svn false guojiannan jiannan10
|
|
python3 ./build_ci/u2c/CheckoutShare.py ${Branch} client /usr/local/bin/svn false guojiannan jiannan10
|
|
python3 ./build_ci/u2c/CleanSVNUnversioned.py
|
|
'''
|
|
}
|
|
}
|
|
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 jp
|
|
python3 ./ExportLanguageToText.py
|
|
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
stage('编译proto')
|
|
{
|
|
steps
|
|
{
|
|
script{
|
|
sh """
|
|
cd ${env.sharePath}/protocol
|
|
chmod 774 export_lua.py
|
|
python3 ./export_lua.py
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
stage('Set Env Value')
|
|
{
|
|
steps
|
|
{
|
|
script{
|
|
// 设置默认渠道
|
|
env.publishChannel = "${publishChannel}" ?: "ios_oversea"
|
|
if ("${config_flag}" == "JP") {
|
|
env.publishChannel = "ios_japan"
|
|
}
|
|
if ("${config_flag}" == "SEA") {
|
|
env.publishChannel = "ios_southeast"
|
|
}
|
|
if ("${config_flag}" == "KR") {
|
|
env.publishChannel = "ios_korea"
|
|
}
|
|
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.pandora_cli_proj}/build/XcodeProject"
|
|
echo "${env.outpath}"
|
|
}
|
|
}
|
|
}
|
|
|
|
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}
|
|
if [ $? -ne 0 ]; then
|
|
echo "ProcessTextureFormat failed..."
|
|
exit 1
|
|
fi
|
|
|
|
'''
|
|
}
|
|
}
|
|
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}
|
|
|
|
if [ "$config_flag" == "JP" ]; then
|
|
echo "use japan config"
|
|
python3 ${pandora_cli_proj}/../pandora_share_proj/MacBuild/build_copy_config.py JP
|
|
fi
|
|
|
|
if [ "$config_flag" == "KR" ]; then
|
|
echo "use japan config"
|
|
python3 ${pandora_cli_proj}/../pandora_share_proj/MacBuild/build_copy_config.py KR
|
|
fi
|
|
|
|
if [ "$config_flag" == "SEA" ]; then
|
|
echo "use SoutheastAsia config"
|
|
python3 ${pandora_cli_proj}/../pandora_share_proj/MacBuild/build_copy_config.py SEA
|
|
fi
|
|
|
|
#占位参数,为了与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}
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "ProcessTextureFormat failed..."
|
|
exit 1
|
|
fi
|
|
'''
|
|
}
|
|
}
|
|
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/JP" "${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
|
|
/usr/libexec/PlistBuddy -c 'Set:CFBundleName '"${BundleNAME}"'' ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject/Info.plist
|
|
cd ${WORKSPACE}/pandora_cli_proj/pandoraTempForPureAPP/build/XcodeProject
|
|
xcodebuild clean -alltargets
|
|
echo $PATH
|
|
|
|
/opt/homebrew/bin/hero-pack -config ${WORKSPACE}/iOS_Config/JP/${JOB_BASE_NAME}/packConfig.json
|
|
if [ $? -ne 0 ]; then
|
|
echo "hero-pack failed..."
|
|
exit 1
|
|
fi
|
|
|
|
#xcodebuild archive -project Unity-iPhone.xcodeproj -scheme Unity-iPhone -sdk iphoneos -configuration Debug -archivePath ${WORKSPACE}/build/IPA.xcarchive
|
|
|
|
#xcodebuild -exportArchive -archivePath ${WORKSPACE}/build/IPA.xcarchive -exportPath ${WORKSPACE}/build/ipa -exportOptionsPlist /Users/pandora/Desktop/ExportOptions.plist
|
|
'''
|
|
}
|
|
}
|
|
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}/${BundleNAME}.ipa" ]; then
|
|
echo "dev文件不存在"
|
|
exit 1
|
|
fi
|
|
cp -n "${DistOutputPath}/${latest_folder}/${BundleNAME}.ipa" "/Volumes/volume1/download/DownloadAPK/JP/${build_file_name}_dev.ipa"
|
|
|
|
if [ ! -f "${DistOutputPath}/${latest_folder}/dis/${BundleNAME}.ipa" ]; then
|
|
echo "dis文件不存在"
|
|
exit 1
|
|
fi
|
|
cp -n "${DistOutputPath}/${latest_folder}/dis/${BundleNAME}.ipa" "/Volumes/volume1/download/DownloadAPK/JP/${build_file_name}_dis.ipa"
|
|
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
post
|
|
{
|
|
success
|
|
{
|
|
wrap([$class: 'BuildUser']) {
|
|
script {
|
|
env.buildUser = "${env.BUILD_USER}"
|
|
}
|
|
buildName "#${env.BUILD_NUMBER} ---> ${version}"
|
|
buildDescription "<a href=\"http://10.0.22.152:8082/DownloadAPk/JP/${build_file_name}_dev.ipa\">点击下载: pandora_${version}_dev</a>\n \
|
|
<a href=\"http://10.0.22.152:8082/DownloadAPk/JP/${build_file_name}_dis.ipa\">点击下载: pandora_${version}_dev</a>"
|
|
|
|
}
|
|
//sh label: '', script: """sh ${env.u2china_share_proj}/JenkinsFile/feishu_buildPackage.sh ${buildUser} ${appVersion} SUCCESS ${env.JOB_NAME} apk"""
|
|
sh label: '',
|
|
script:'''
|
|
curl -X POST -H "Content-Type: application/json" -d \
|
|
'{
|
|
"msg_type": "interactive",
|
|
"card": {
|
|
"elements":
|
|
[{
|
|
"tag": "div",
|
|
"text": {
|
|
"content": "构建者:'$BUILD_USER'",
|
|
"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.22.152:8082/DownloadAPk/JP/'$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.22.152:8082/DownloadAPk/JP/'$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
|
|
'''
|
|
}
|
|
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"
|
|
}
|
|
}
|
|
}
|
|
|
|
|