删除旧的打包工具
parent
5d3fa8feb7
commit
e4bc0c859d
|
|
@ -1,63 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
SHELL_DIR=$(dirname "$0")
|
||||
echo "Change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
PROJECT_PATH=$(dirname "$(dirname "$PWD")")
|
||||
|
||||
# 设置asmdef文件的路径
|
||||
ASMDEF_FILE="$PROJECT_PATH/ProjectNLD/Assets/PhxhSDK/Phxh/Phxh.asmdef"
|
||||
|
||||
# 设置AppleAuth的路径
|
||||
APPLEAUTH_FILE="$PROJECT_PATH/ProjectNLD/Assets/PhxhSDK/ThirdParty/AppleSignInUnity"
|
||||
|
||||
echo "$ASMDEF_FILE"
|
||||
|
||||
# 检查文件是否存在
|
||||
if [ ! -f "$ASMDEF_FILE" ]; then
|
||||
echo "File not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 备份原始文件
|
||||
cp "$ASMDEF_FILE" "$ASMDEF_FILE.bak"
|
||||
|
||||
# 使用awk删除包含"AppleAuth"的行及其前一行末尾的逗号(如果是唯一条目)或仅删除该行(如果后面有更多条目)
|
||||
awk '
|
||||
BEGIN {found=0}
|
||||
{
|
||||
if ($0 ~ /"AppleAuth"/) {
|
||||
if ($0 ~ /,/) {
|
||||
next
|
||||
} else {
|
||||
sub(/,$/, "", prev)
|
||||
found=1
|
||||
next
|
||||
}
|
||||
}
|
||||
if (NR > 1) print prev
|
||||
prev=$0
|
||||
}
|
||||
END { if (found == 0) print prev }
|
||||
' "$ASMDEF_FILE" > "$ASMDEF_FILE.tmp"
|
||||
|
||||
# 检查操作是否成功
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to process the JSON file"
|
||||
mv "$ASMDEF_FILE.bak" "$ASMDEF_FILE" # 还原备份
|
||||
exit 1
|
||||
else
|
||||
mv "$ASMDEF_FILE.tmp" "$ASMDEF_FILE"
|
||||
# 删除备份文件
|
||||
rm "$ASMDEF_FILE.bak"
|
||||
echo "AppleAuth package has been removed from the asmdef file and backup has been deleted."
|
||||
fi
|
||||
|
||||
# 删除AppleAuth资源包
|
||||
if [ -d "$APPLEAUTH_FILE" ]; then
|
||||
rm -rf "$APPLEAUTH_FILE"
|
||||
echo "AppleAuth package has been deleted."
|
||||
else
|
||||
echo "AppleAuth package not found, nothing to delete."
|
||||
fi
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/bash
|
||||
script_directory="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
#if [ "$#" -eq 0 ]; then
|
||||
# echo "Usage: $0 <text>"
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
text="$1"
|
||||
|
||||
#测试用
|
||||
#text="[Licensing::Client] Error: HandshakeResponse reported an error:
|
||||
# Assets/Code/Scripts/Gameplay/UI/Shop/UI_ShopController.cs(94,77): error CS0117: 'SDKManager.SdkName' does not contain a definition for 'IAP'
|
||||
# Assets/Code/Scripts/Gameplay/UI/Shop/UI_ShopController.cs(94,85): error CS0246: The type or namespace name 'IBuyServices' could not be found (are you missing a using directive or an assembly reference?)
|
||||
# Assets/Code/Scripts/Gameplay/UI/Shop/UI_ShopController.cs(94,77): error CS0117: 'SDKManager.SdkName' does not contain a definition for 'IAP'
|
||||
# Assets/Code/Scripts/Gameplay/UI/Shop/UI_ShopController.cs(94,85): error CS0246: The type or namespace name 'IBuyServices' could not be found (are you missing a using directive or an assembly reference?)
|
||||
# Assets/Code/Scripts/Gameplay/UI/Shop/UI_ShopController.cs(94,77): error CS0117: 'SDKManager.SdkName' does not contain a definition for 'IAP'
|
||||
# Assets/Code/Scripts/Gameplay/UI/Shop/UI_ShopController.cs(94,85): error CS0246: The type or namespace name 'IBuyServices' could not be found (are you missing a using directive or an assembly reference?)
|
||||
# Scripts have compiler errors."
|
||||
|
||||
echo "blame start $text"
|
||||
|
||||
if [[ $text =~ (Assets\/[^:\(]+)\/([^:\(]+\.cs)[:\(]([0-9]+) ]]; then
|
||||
path="${BASH_REMATCH[1]}"
|
||||
fileName="${BASH_REMATCH[2]}"
|
||||
line_number="${BASH_REMATCH[3]}"
|
||||
echo "blame path:$path"
|
||||
echo "blame file: $fileName"
|
||||
echo "blame line_num: $line_number"
|
||||
cd ../../ProjectNLD/"$path" || exit
|
||||
#git blame -L "$line_number" "$fileName"
|
||||
last_commit_author=$(git blame -L "$line_number" "$fileName" | sed 's/^[^(]*(\([^[:space:]]*\).*/\1/' | head -n 1)
|
||||
message="fileName:$path/$fileName \r\n line_num:$line_number \r\n author:${last_commit_author}"
|
||||
echo "message:$message"
|
||||
cd "$script_directory" || exit
|
||||
sh to_inner_wechat_robot.sh "$message"
|
||||
fi
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目路径参数
|
||||
if [ -f ./local_env.sh ]; then
|
||||
source ./local_env.sh
|
||||
echo "found the local_env file"
|
||||
fi
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
|
||||
VERSION="$1"
|
||||
PROFILE="$2"
|
||||
ARTIFACT_URL="$3"
|
||||
ENABLE_HOT_UPDATE="$4"
|
||||
PLATFORM="$5"
|
||||
CLEARCACHED="$6"
|
||||
DEVELPOMENT_BUILD="$7"
|
||||
CHANNEL="$8"
|
||||
AAB="$9"
|
||||
|
||||
echo "version="$VERSION", profile="$PROFILE", PLATFORM="$PLATFORM""
|
||||
echo "ARTIFACT_URL="$ARTIFACT_URL", ENABLE_HOT_UPDATE="$ENABLE_HOT_UPDATE""
|
||||
echo "CLEARCACHED="$CLEARCACHED", DEVELPOMENT_BUILD = "$DEVELPOMENT_BUILD""
|
||||
echo "AAB="$AAB", PROJECT_NAME="$PROJECT_NAME""
|
||||
echo "BUILD_NAME="$BUILD_NAME", APP_NAME="$APP_NAME""
|
||||
|
||||
# Set the build folder and name
|
||||
BUILD_FOLDER_FROM_ASSET="../Builds/$PLATFORM/$VERSION" #相对assets路径
|
||||
BUILD_FOLDER="../../Builds/$PLATFORM/$VERSION" #相对脚本路径
|
||||
|
||||
EXECUTE_METHOD="BatchBuild.BuildContentAndPlayer"
|
||||
EXECUTE_SETTING_METHOD="BatchBuild.ApplyPlayerSetting"
|
||||
LOG_FILE="$BUILD_FOLDER/build.log" # 相对脚本路径
|
||||
|
||||
echo "Start apply setting ... ... "
|
||||
|
||||
"$UNITY_PATH" -quit -batchmode -projectPath "../../$PROJECT_NAME" -executeMethod "$EXECUTE_SETTING_METHOD"\
|
||||
-platform "$PLATFORM" \
|
||||
-appVersion "$VERSION" \
|
||||
-buildName "$BUILD_NAME" \
|
||||
-profile "$PROFILE" \
|
||||
-outpath "$BUILD_FOLDER_FROM_ASSET" \
|
||||
-appName "$APP_NAME" \
|
||||
-clearCached "$CLEARCACHED" \
|
||||
-logFile "$LOG_FILE" \
|
||||
-enableHotUpdate "$ENABLE_HOT_UPDATE" \
|
||||
-developmentBuild "$DEVELPOMENT_BUILD" \
|
||||
-channel "$CHANNEL" \
|
||||
-aab "$AAB"
|
||||
|
||||
|
||||
echo "build folder is: "$BUILD_FOLDER" , log is : "$LOG_FILE" , Start building ... ... "
|
||||
|
||||
"$UNITY_PATH" -quit -batchmode -projectPath "../../$PROJECT_NAME" -executeMethod "$EXECUTE_METHOD"\
|
||||
-platform "$PLATFORM" \
|
||||
-appVersion "$VERSION" \
|
||||
-buildName "$BUILD_NAME" \
|
||||
-profile "$PROFILE" \
|
||||
-outpath "$BUILD_FOLDER_FROM_ASSET" \
|
||||
-appName "$APP_NAME" \
|
||||
-clearCached "$CLEARCACHED" \
|
||||
-logFile "$LOG_FILE" \
|
||||
-enableHotUpdate "$ENABLE_HOT_UPDATE" \
|
||||
-developmentBuild "$DEVELPOMENT_BUILD" \
|
||||
-channel "$CHANNEL" \
|
||||
-aab "$AAB"
|
||||
|
||||
build_result=$?
|
||||
|
||||
if [ $build_result -ne 0 ]; then
|
||||
echo "【"$PLATFORM"】【"$VERSION"】Unity build failed. Check the log for details."
|
||||
sh to_inner_wechat_robot.sh "【$PLATFORM】【$VERSION】【$PROFILE】Failed to build"
|
||||
sh collect_and_send_error.sh $LOG_FILE
|
||||
exit 1
|
||||
else
|
||||
echo "【"$PLATFORM"】【"$VERSION"】Unity build successful."
|
||||
fi
|
||||
|
||||
# upload remote resource to server
|
||||
#sh upload_to_server.sh "$PLATFORM" "$VERSION"
|
||||
|
||||
SYMBOL_FILE="$BUILD_FOLDER/$BUILD_NAME-$VERSION-v1-IL2CPP.symbols" # 相对脚本路径
|
||||
|
||||
unzip "$SYMBOL_FILE".zip -d "$SYMBOL_FILE"
|
||||
|
||||
java -jar crashSightSymbolTool.jar \
|
||||
-i "$BUILD_FOLDER" \
|
||||
-version "$VERSION" \
|
||||
-p aos \
|
||||
-m win \
|
||||
-u -url https://api.crashsight.qq.com/openapi/file/upload/symbol \
|
||||
-id 669a94ce69 \
|
||||
-key d9412717-2416-4270-b8bc-f7a0805f988f
|
||||
|
||||
upload_result=$?
|
||||
|
||||
if [ $upload_result -eq 0 ]; then
|
||||
echo "Symbol table upload CrashSight successfully!"
|
||||
|
||||
else
|
||||
echo "Symbol table upload CrashSight failed"
|
||||
fi
|
||||
|
||||
rm -rf "$SYMBOL_FILE"
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
|
||||
VERSION="$1"
|
||||
PROFILE="$2"
|
||||
ARTIFACT_URL="$3"
|
||||
ENABLE_HOT_UPDATE="$4"
|
||||
DEVELPOMENT_BUILD="$5"
|
||||
WORKSPACE="$6"
|
||||
AAB=false
|
||||
|
||||
|
||||
# Set the target platform (e.g. Android, iOS, Windows, etc.)
|
||||
PLATFORM="Android"
|
||||
#PLATFORM="iOS"
|
||||
|
||||
# Set if needs to clear cache
|
||||
CLEARCACHED="yes"
|
||||
#CLEARCACHED="no"
|
||||
|
||||
sh build.sh $VERSION $PROFILE $ARTIFACT_URL $ENABLE_HOT_UPDATE $PLATFORM $CLEARCACHED $DEVELPOMENT_BUILD $WORKSPACE $AAB
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
|
||||
VERSION="$1"
|
||||
PROFILE="$2"
|
||||
ARTIFACT_URL="$3"
|
||||
ENABLE_HOT_UPDATE="$4"
|
||||
DEVELPOMENT_BUILD="$5"
|
||||
WORKSPACE="$6"
|
||||
AAB="$7"
|
||||
|
||||
|
||||
# Set the target platform (e.g. Android, iOS, Windows, etc.)
|
||||
PLATFORM="Android"
|
||||
#PLATFORM="iOS"
|
||||
|
||||
# Set if needs to clear cache
|
||||
CLEARCACHED="yes"
|
||||
#CLEARCACHED="no"
|
||||
|
||||
sh build.sh $VERSION $PROFILE $ARTIFACT_URL $ENABLE_HOT_UPDATE $PLATFORM $CLEARCACHED $DEVELPOMENT_BUILD $WORKSPACE $AAB
|
||||
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
|
||||
VERSION="$1"
|
||||
PROFILE="$2"
|
||||
ARTIFACT_URL="$3"
|
||||
ENABLE_HOT_UPDATE="$4"
|
||||
DEVELPOMENT_BUILD="$5"
|
||||
WORKSPACE="$6"
|
||||
|
||||
|
||||
# Set the target platform (e.g. Android, iOS, Windows, etc.)
|
||||
PLATFORM="iOS"
|
||||
|
||||
# Set if needs to clear cache
|
||||
CLEARCACHED="yes"
|
||||
#CLEARCACHED="no"
|
||||
|
||||
sh build.sh $VERSION $PROFILE $ARTIFACT_URL $ENABLE_HOT_UPDATE $PLATFORM $CLEARCACHED $DEVELPOMENT_BUILD $WORKSPACE
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#Addressable 资源
|
||||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# Source the local environment
|
||||
if [ -f ./local_env.sh ]; then
|
||||
source ./local_env.sh
|
||||
echo "found the local_env file"
|
||||
fi
|
||||
|
||||
# Set the target platform (e.g., Android, iOS, Windows, etc.)
|
||||
PLATFORM="Android"
|
||||
#PLATFORM="iOS"
|
||||
|
||||
# Set if needs to clear cache
|
||||
CLEARCACHED="yes"
|
||||
#CLEARCACHED="no"
|
||||
|
||||
#Set build Addressables groups (modify as needed)
|
||||
ADDRESSABLES_GROUPS="Level"
|
||||
|
||||
EXECUTE_METHOD="BatchBuild.BuildAddressables"
|
||||
LOG_FILE="$PROJECT_BUILD_FOLDER/$PLATFORM/$VERSION/buildResource.log"
|
||||
|
||||
# Set the URL where you want to send the message
|
||||
NOTE_URL="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
|
||||
|
||||
echo "Start building Addressables groups [$ADDRESSABLES_GROUPS]... ..."
|
||||
|
||||
# Execute Unity build command
|
||||
"$UNITY_PATH" -quit -batchmode -projectPath "$PROJECT_PATH" -executeMethod "$EXECUTE_METHOD" \
|
||||
-platform "$PLATFORM" \
|
||||
-profile Debug \
|
||||
-clearCached "$CLEARCACHED" \
|
||||
-groups "$ADDRESSABLES_GROUPS" \
|
||||
-logFile "$LOG_FILE"
|
||||
|
||||
build_result=$?
|
||||
|
||||
if [ $build_result -ne 0 ]; then
|
||||
echo "GROUPS: [$ADDRESSABLES_GROUPS] build failed. Check the log for details."
|
||||
sh to_inner_wechat_robot.sh " ADDRESSABLES GROUPS: [$ADDRESSABLES_GROUPS] 构建失败, 错误码【"$build_result"】,详情查看工作机器上的Log"
|
||||
exit 1
|
||||
|
||||
else
|
||||
echo "GROUPS: [$ADDRESSABLES_GROUPS] build successful."
|
||||
fi
|
||||
|
||||
#sh to_inner_wechat_robot.sh "$MESSAGE"
|
||||
|
||||
# upload remote resource to server
|
||||
#sh upload_to_server.sh "$PLATFORM" "$VERSION"
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script automates the process of building an Xcode project and creating an IPA file.
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
PROJECT_NAME="$1"
|
||||
SCHEME_NAME="$2"
|
||||
PLATFORM="$3"
|
||||
VERSION="$4"
|
||||
|
||||
PROJECT_PATH="../../Builds/$PLATFORM/$VERSION/$BUILD_NAME/"
|
||||
#PROJECT_NAME="Unity-iPhone" # Replace with your Xcode project name (without the .xcodeproj extension)
|
||||
#SCHEME_NAME="Unity-iPhone" # Replace with your Xcode scheme
|
||||
OUTPUT_DIRECTORY="../" # Replace with the desired output directory for the IPA file
|
||||
|
||||
|
||||
# create export Options plist
|
||||
#echo "Generating a new exportOptions.plist file"
|
||||
#sh generate_exportOptions.sh $PACKAGE_NAME $PACKAGE_ID
|
||||
|
||||
|
||||
# Define source and destination paths
|
||||
EXPORT_OPTIONS_FILE="./exportOptions.plist"
|
||||
|
||||
# Copy the file
|
||||
echo "copy export options to $PROJECT_PATH"
|
||||
cp "$EXPORT_OPTIONS_FILE" "$PROJECT_PATH"
|
||||
|
||||
|
||||
echo "change direction to $PROJECT_PATH"
|
||||
cd $PROJECT_PATH
|
||||
|
||||
xcodebuild -list -project $PROJECT_NAME.xcodeproj
|
||||
|
||||
|
||||
echo "clean..."
|
||||
xcodebuild clean
|
||||
|
||||
|
||||
# Build the Xcode project and create an archive
|
||||
echo "Building Xcode project..."
|
||||
xcodebuild archive -project $PROJECT_NAME.xcodeproj -scheme $SCHEME_NAME -archivePath $OUTPUT_DIRECTORY/$PROJECT_NAME.xcarchive
|
||||
|
||||
# Export the archive to create an IPA file
|
||||
echo "Exporting archive to IPA..."
|
||||
xcodebuild -exportArchive -archivePath $OUTPUT_DIRECTORY/$PROJECT_NAME.xcarchive -exportPath $OUTPUT_DIRECTORY -exportOptionsPlist exportOptions.plist
|
||||
|
||||
# Clean up the temporary archive
|
||||
echo "Cleaning up temporary archive..."
|
||||
rm -rf $OUTPUT_DIRECTORY/$PROJECT_NAME.xcarchive
|
||||
|
||||
# The script is now complete.
|
||||
echo "Build process completed. IPA file is available at: $OUTPUT_DIRECTORY/$BUILD_NAME.ipa"
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Check if a filename is provided as an argument
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: $0 <filename>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo"$0"
|
||||
|
||||
# Get the filename from the command line argument
|
||||
filename="$1"
|
||||
|
||||
exception=$(grep -A 12 "\[Build Exception\]:" "$filename")
|
||||
# Use grep to search for lines containing the word "error"
|
||||
error=$(grep "error" "$filename")
|
||||
|
||||
echo "exception: $exception"
|
||||
echo "error: $error"
|
||||
|
||||
# Pass the result to another script
|
||||
sh to_inner_wechat_robot.sh "$exception"
|
||||
sh blame.sh "$exception"
|
||||
sh to_inner_wechat_robot.sh "$error"
|
||||
sh blame.sh "$error"
|
||||
|
||||
|
||||
Binary file not shown.
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>method</key>
|
||||
<string>development</string>
|
||||
<!-- Use "app-store" for distribution through the App Store -->
|
||||
<!-- Use "ad-hoc" for ad-hoc distribution -->
|
||||
<!-- Use "enterprise" for enterprise distribution -->
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
def VERSION_PARAM = params.VERSION
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def PLATFORM_PARAM = "Android"
|
||||
def ARTIFACT_URL = "http://192.168.2.159:8080/job/${env.JOB_NAME}/"
|
||||
def Enable_Hot_Update = "false"
|
||||
def BUILD_PATH = "Builds/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
def build_result
|
||||
|
||||
def checkFolderExists(folderPath) {
|
||||
def combieCmd = "test -d ${folderPath} && echo exists || echo not exists"
|
||||
def folderExists = sh(script: combieCmd, returnStdout: true).trim()
|
||||
if (folderExists == 'exists') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
def checkFileExists(filePath) {
|
||||
def combieCmd = "test -f ${filePath} && echo exists || echo not exists"
|
||||
def fileExists = sh(script: combieCmd, returnStdout: true).trim()
|
||||
if (fileExists == 'exists') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
def copyFolder(sourceFolder, targetFolder) {
|
||||
sh "cp -Rf ${sourceFolder} ${targetFolder}"
|
||||
}
|
||||
|
||||
def copyFile(sourceFile, targetFile) {
|
||||
sh "cp -f ${sourceFile} ${targetFile}"
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('拉最新工程') {
|
||||
steps {
|
||||
//echo 'p4 拉取最新的代码....'
|
||||
//checkout perforce(
|
||||
//credential: 'af66652c-5a02-4d8c-9727-9955d855d23f',
|
||||
//populate: autoClean(delete: true, modtime: false,
|
||||
//parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'],
|
||||
//pin: '', quiet: true, replace: true, tidy: false),
|
||||
//workspace: streamSpec(charset: 'utf8', format: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, streamName: '//ProjectNLD/main')
|
||||
//)
|
||||
echo 'git 还原本地修改....'
|
||||
script {
|
||||
// 保存当前工作路径
|
||||
def currentPath = sh(script: 'pwd', returnStdout: true).trim()
|
||||
echo "Current path: ${currentPath}"
|
||||
// 先删除Assets/PhxhSDK/Phxh/SDKHelper文件夹
|
||||
def sdkHelperPath = "$WORKSPACE/ProjectNLD/Assets/PhxhSDK/Phxh/SDKHelper"
|
||||
if (checkFolderExists(sdkHelperPath)) {
|
||||
echo "准备删除${sdkHelperPath}文件夹"
|
||||
sh "rm -rf ${sdkHelperPath}"
|
||||
echo "删除${sdkHelperPath}文件夹成功"
|
||||
}
|
||||
// cd到Phxh目录并进行还原
|
||||
echo "cd $WORKSPACE/ProjectNLD/Assets/PhxhSDK/Phxh"
|
||||
sh "cd $WORKSPACE/ProjectNLD/Assets/PhxhSDK/Phxh && git checkout -- ."
|
||||
|
||||
// def projectSettingsPath = "$WORKSPACE/ProjectNLD/ProjectSettings"
|
||||
// if (checkFolderExists(projectSettingsPath)) {
|
||||
// echo "准备删除${projectSettingsPath}文件夹"
|
||||
// sh "rm -rf ${projectSettingsPath}"
|
||||
// echo "删除${projectSettingsPath}文件夹成功"
|
||||
// }
|
||||
// // cd到ProjectSettings目录并进行还原
|
||||
// echo "cd $WORKSPACE/ProjectNLD/ProjectSettings"
|
||||
// sh "cd $WORKSPACE/ProjectNLD/ProjectSettings && git checkout -- ."
|
||||
|
||||
// cd到工作路径
|
||||
echo "cd ${currentPath}"
|
||||
}
|
||||
echo 'git 拉取最新的代码....'
|
||||
checkout scmGit(branches: [[name: '*/main']],
|
||||
extensions: [checkoutOption(60), lfs(), submodule(recursiveSubmodules: true, reference: '', timeout: 1200)],
|
||||
userRemoteConfigs: [[url: 'http://1.14.122.170:3000/PHXH/NLDClient.git']])
|
||||
}
|
||||
}
|
||||
stage('根据channel拷贝文件') {
|
||||
steps {
|
||||
script {
|
||||
echo "根据channel拷贝文件"
|
||||
// 先判定channel文件夹是否存在
|
||||
def channelPath = "$WORKSPACE/Tool/Channels/${params.Channel}"
|
||||
if (!checkFolderExists(channelPath)) {
|
||||
error("Channel文件夹不存在: ${channelPath}")
|
||||
}
|
||||
// 判断define_list.txt文件是否存在
|
||||
def defineListPath = "${channelPath}/define_list.txt"
|
||||
if (!checkFileExists(defineListPath)) {
|
||||
error("define_list.txt文件不存在: ${defineListPath}")
|
||||
}
|
||||
// 拷贝Asset文件夹
|
||||
def channelAssetPath = "${channelPath}/Assets"
|
||||
if (checkFolderExists(channelAssetPath)) {
|
||||
copyFolder(channelAssetPath, "$WORKSPACE/ProjectNLD/")
|
||||
echo "拷贝Asset文件夹成功"
|
||||
}
|
||||
// 拷贝ProjectSettings文件夹
|
||||
def channelProjectSettingsPath = "${channelPath}/ProjectSettings"
|
||||
if (checkFolderExists(channelProjectSettingsPath)) {
|
||||
copyFolder(channelProjectSettingsPath, "$WORKSPACE/ProjectNLD/")
|
||||
echo "拷贝ProjectSettings文件夹成功"
|
||||
}
|
||||
// 拷贝define_list.txt文件
|
||||
copyFile(defineListPath, "$WORKSPACE/ProjectNLD/define_list.txt")
|
||||
echo "拷贝define_list.txt文件成功"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
echo "copy local env file to ${WORKSPACE}"
|
||||
sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/BuildTool/"
|
||||
echo "make shell executable"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/build_android_debug.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/update_build_resource_android_debug.sh"
|
||||
echo "execute build shell"
|
||||
script {
|
||||
if(params.Debug_AllLocal == true)
|
||||
PROFILE_PARAM="AllLocal"
|
||||
if(params.Enable_Hot_Update == true)
|
||||
Enable_Hot_Update = "true"
|
||||
if(params.Update_Previous_Build == true)
|
||||
build_result=sh(script: "$WORKSPACE/Tool/BuildTool/update_build_resource_android_debug.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${ARTIFACT_URL} ${Enable_Hot_Update}", returnStatus: true, returnStdout: false)
|
||||
else
|
||||
build_result=sh(script: "$WORKSPACE/Tool/BuildTool/build_android_debug.sh ${VERSION_PARAM} ${PROFILE_PARAM} ${ARTIFACT_URL} ${Enable_Hot_Update}", returnStatus: true, returnStdout: false)
|
||||
if(build_result != 0)
|
||||
{
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/build.log" , followSymlinks: false
|
||||
error("Failure of the '打包' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传') {
|
||||
steps {
|
||||
echo "上传"
|
||||
echo "make shell executable"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/upload_to_server.sh"
|
||||
echo "execute build shell"
|
||||
sh "$WORKSPACE/Tool/BuildTool/upload_to_server.sh ${VERSION_PARAM} ${PLATFORM_PARAM}"
|
||||
}
|
||||
}
|
||||
stage('归档') {
|
||||
steps {
|
||||
echo "归档"
|
||||
script {
|
||||
if (params.Update_Previous_Build == false) {
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.apk" , followSymlinks: false
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/build.log" , followSymlinks: false
|
||||
} else {
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/UpdatePreviousBuild.log" , followSymlinks: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('通知') {
|
||||
steps {
|
||||
echo "通知"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/to_wechat_robot.sh"
|
||||
script {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【${PROFILE_PARAM}】客户端打包上传成功!下载链接:${ARTIFACT_URL}"
|
||||
sh "$WORKSPACE/Tool/BuildTool/to_wechat_robot.sh ${message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,213 +0,0 @@
|
|||
def VERSION_PARAM = params.VERSION
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def PLATFORM_PARAM = "Android"
|
||||
def ARTIFACT_URL = "http://${env.PHXH_BUILDER_IP_ADDRESS}:8080/job/${env.JOB_NAME}/"
|
||||
def Enable_Hot_Update = "false"
|
||||
def BUILD_PATH = "Builds/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
def build_result
|
||||
|
||||
def checkFolderExists(folderPath) {
|
||||
def combieCmd = "test -d ${folderPath} && echo exists || echo not exists"
|
||||
def folderExists = sh(script: combieCmd, returnStdout: true).trim()
|
||||
if (folderExists == 'exists') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
def checkFileExists(filePath) {
|
||||
def combieCmd = "test -f ${filePath} && echo exists || echo not exists"
|
||||
def fileExists = sh(script: combieCmd, returnStdout: true).trim()
|
||||
if (fileExists == 'exists') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
def copyFolder(sourceFolder, targetFolder) {
|
||||
sh "cp -Rf ${sourceFolder} ${targetFolder}"
|
||||
}
|
||||
|
||||
def copyFile(sourceFile, targetFile) {
|
||||
sh "cp -f ${sourceFile} ${targetFile}"
|
||||
}
|
||||
|
||||
def SendMessageToWechat(message){
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh"
|
||||
sh "$WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh ${message}"
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('拉最新工程') {
|
||||
steps {
|
||||
echo 'git 还原本地修改....'
|
||||
script {
|
||||
try{
|
||||
// 保存当前工作路径
|
||||
def currentPath = sh(script: 'pwd', returnStdout: true).trim()
|
||||
echo "Current path: ${currentPath}"
|
||||
// 先删除Assets/PhxhSDK/Phxh/SDKHelper文件夹
|
||||
def sdkHelperPath = "$WORKSPACE/ProjectNLD/Assets/PhxhSDK/Phxh/SDKHelper"
|
||||
if (checkFolderExists(sdkHelperPath)) {
|
||||
echo "准备删除${sdkHelperPath}文件夹"
|
||||
sh "rm -rf ${sdkHelperPath}"
|
||||
echo "删除${sdkHelperPath}文件夹成功"
|
||||
}
|
||||
// cd到Phxh目录并进行还原
|
||||
def phxhPath = "$WORKSPACE/ProjectNLD/Assets/PhxhSDK"
|
||||
if(checkFolderExists(phxhPath))
|
||||
{
|
||||
echo "cd $phxhPath"
|
||||
sh "cd $phxhPath && git checkout -- ."
|
||||
}
|
||||
|
||||
// cd到工作路径
|
||||
echo "cd ${currentPath}"
|
||||
echo 'git 拉取最新的代码....'
|
||||
checkout scmGit(branches: [[name: '*/main']],
|
||||
extensions: [checkoutOption(60), 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']])
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('根据channel修改工程') {
|
||||
steps {
|
||||
script {
|
||||
try{
|
||||
echo "根据channel拷贝文件"
|
||||
// 先判定channel文件夹是否存在
|
||||
def channelPath = "$WORKSPACE/Tool/Channels/${params.Channel}"
|
||||
if (!checkFolderExists(channelPath)) {
|
||||
error("Channel文件夹不存在: ${channelPath}")
|
||||
}
|
||||
// 判断PlayerSettings.txt文件是否存在
|
||||
def defineListPath = "${channelPath}/PlayerSettings.txt"
|
||||
if (!checkFileExists(defineListPath)) {
|
||||
error("PlayerSettings.txt文件不存在: ${defineListPath}")
|
||||
}
|
||||
// 拷贝Asset文件夹
|
||||
def channelAssetPath = "${channelPath}/Assets"
|
||||
if (checkFolderExists(channelAssetPath)) {
|
||||
copyFolder(channelAssetPath, "$WORKSPACE/ProjectNLD/")
|
||||
echo "拷贝Asset文件夹成功"
|
||||
}
|
||||
// 拷贝ProjectSettings文件夹
|
||||
def channelProjectSettingsPath = "${channelPath}/ProjectSettings"
|
||||
if (checkFolderExists(channelProjectSettingsPath)) {
|
||||
copyFolder(channelProjectSettingsPath, "$WORKSPACE/ProjectNLD/")
|
||||
echo "拷贝ProjectSettings文件夹成功"
|
||||
}
|
||||
// 拷贝PlayerSettings.txt文件
|
||||
copyFile(defineListPath, "$WORKSPACE/ProjectNLD/PlayerSettings.txt")
|
||||
echo "拷贝PlayerSettings.txt文件成功"
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
echo "copy local env file to ${WORKSPACE}"
|
||||
sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/BuildTool/"
|
||||
echo "make shell executable"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/build_android_debug.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/update_build_resource_debug.sh"
|
||||
echo "execute build shell"
|
||||
script {
|
||||
try{
|
||||
if(params.Debug_AllLocal == true)
|
||||
PROFILE_PARAM="AllLocal"
|
||||
if(params.Enable_Hot_Update == true)
|
||||
Enable_Hot_Update = "true"
|
||||
if(params.Build_InitApp == false)
|
||||
build_result=sh(script: "$WORKSPACE/Tool/BuildTool/update_build_resource_debug.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${params.Channel} ${Enable_Hot_Update} ${ARTIFACT_URL}", returnStatus: true, returnStdout: false)
|
||||
else
|
||||
build_result=sh(script: "$WORKSPACE/Tool/BuildTool/build_android_debug.sh ${VERSION_PARAM} ${PROFILE_PARAM} ${ARTIFACT_URL} ${Enable_Hot_Update} ${params.DebugBuild} ${params.Channel}", returnStatus: true, returnStdout: false)
|
||||
if(build_result != 0)
|
||||
{
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/build.log" , followSymlinks: false
|
||||
error("Failure of the '打包' stage")
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传资源') {
|
||||
steps {
|
||||
echo "上传"
|
||||
echo "make shell executable"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/upload_to_server.sh"
|
||||
echo "execute build shell"
|
||||
script {
|
||||
def ASSET_PATH = "$WORKSPACE/ProjectNLD/ServerData/${PLATFORM_PARAM}"
|
||||
sh "$WORKSPACE/Tool/BuildTool/upload_to_server.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${params.Channel} ${ASSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('上传apk') {
|
||||
steps {
|
||||
echo "上传apk"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/upload_apk.sh"
|
||||
script {
|
||||
sh "$WORKSPACE/Tool/BuildTool/upload_apk.sh ${PLATFORM_PARAM} ${params.Channel} ${VERSION_PARAM}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('归档') {
|
||||
steps {
|
||||
echo "归档"
|
||||
script {
|
||||
try{
|
||||
if (params.Build_InitApp == true) {
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.apk" , followSymlinks: false
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/build.log" , followSymlinks: false
|
||||
} else {
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/UpdatePreviousBuild.log" , followSymlinks: false
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('通知') {
|
||||
steps {
|
||||
echo "通知"
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【${PROFILE_PARAM}】客户端打包上传成功!下载链接:${ARTIFACT_URL}"
|
||||
SendMessageToWechat(message)
|
||||
} else {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【${PROFILE_PARAM}】客户端Addressable增量更新上传成功!下载链接:${ARTIFACT_URL}"
|
||||
SendMessageToWechat(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,250 +0,0 @@
|
|||
def VERSION_PARAM = params.VERSION
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def PLATFORM_PARAM = "iOS"
|
||||
def ARTIFACT_URL = "http://${env.PHXH_BUILDER_IP_ADDRESS}:8080/job/${env.JOB_NAME}/"
|
||||
def Enable_Hot_Update = "false"
|
||||
def BUILD_PATH = "Builds/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
def PROJECT_NAME = "Unity-iPhone"
|
||||
def SCHEME_NAME = "Unity-iPhone"
|
||||
def PACKAGE_NAME = "com.phxh.Try"
|
||||
def PACKAGE_ID="cb64dd5b-ee1f-4587-a27f-a7763465efb1"
|
||||
def build_result
|
||||
|
||||
def checkFolderExists(folderPath) {
|
||||
def combieCmd = "test -d ${folderPath} && echo exists || echo not exists"
|
||||
def folderExists = sh(script: combieCmd, returnStdout: true).trim()
|
||||
if (folderExists == 'exists') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
def checkFileExists(filePath) {
|
||||
def combieCmd = "test -f ${filePath} && echo exists || echo not exists"
|
||||
def fileExists = sh(script: combieCmd, returnStdout: true).trim()
|
||||
if (fileExists == 'exists') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
def copyFolder(sourceFolder, targetFolder) {
|
||||
sh "cp -Rf ${sourceFolder} ${targetFolder}"
|
||||
}
|
||||
|
||||
def copyFile(sourceFile, targetFile) {
|
||||
sh "cp -f ${sourceFile} ${targetFile}"
|
||||
}
|
||||
|
||||
def SendMessageToWechat(message){
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh"
|
||||
sh "$WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh ${message}"
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('拉最新工程') {
|
||||
steps {
|
||||
echo 'git 还原本地修改....'
|
||||
script {
|
||||
try{
|
||||
// 保存当前工作路径
|
||||
def currentPath = sh(script: 'pwd', returnStdout: true).trim()
|
||||
echo "Current path: ${currentPath}"
|
||||
// 先删除Assets/PhxhSDK/Phxh/SDKHelper文件夹
|
||||
def sdkHelperPath = "$WORKSPACE/ProjectNLD/Assets/PhxhSDK/Phxh/SDKHelper"
|
||||
if (checkFolderExists(sdkHelperPath)) {
|
||||
echo "准备删除${sdkHelperPath}文件夹"
|
||||
sh "rm -rf ${sdkHelperPath}"
|
||||
echo "删除${sdkHelperPath}文件夹成功"
|
||||
}
|
||||
// cd到Phxh目录并进行还原
|
||||
def phxhPath = "$WORKSPACE/ProjectNLD/Assets/PhxhSDK"
|
||||
if(checkFolderExists(phxhPath))
|
||||
{
|
||||
echo "cd $phxhPath"
|
||||
sh "cd $phxhPath && git checkout -- ."
|
||||
}
|
||||
|
||||
|
||||
// cd到工作路径
|
||||
echo "cd ${currentPath}"
|
||||
echo 'git 拉取最新的代码....'
|
||||
checkout scmGit(branches: [[name: '*/main']],
|
||||
extensions: [checkoutOption(60), 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']])
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('删除无用asmdef') {
|
||||
steps {
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/RemovePackage.sh"
|
||||
sh "$WORKSPACE/Tool/BuildTool/RemovePackage.sh"
|
||||
}
|
||||
}
|
||||
stage('根据channel修改工程') {
|
||||
steps {
|
||||
script {
|
||||
try{
|
||||
echo "根据channel拷贝文件"
|
||||
// 先判定channel文件夹是否存在
|
||||
def channelPath = "$WORKSPACE/Tool/Channels/${params.Channel}"
|
||||
if (!checkFolderExists(channelPath)) {
|
||||
error("Channel文件夹不存在: ${channelPath}")
|
||||
}
|
||||
// 判断PlayerSettings.txt文件是否存在
|
||||
def defineListPath = "${channelPath}/PlayerSettings.txt"
|
||||
if (!checkFileExists(defineListPath)) {
|
||||
error("PlayerSettings.txt文件不存在: ${defineListPath}")
|
||||
}
|
||||
// 拷贝Asset文件夹
|
||||
def channelAssetPath = "${channelPath}/Assets"
|
||||
if (checkFolderExists(channelAssetPath)) {
|
||||
copyFolder(channelAssetPath, "$WORKSPACE/ProjectNLD/")
|
||||
echo "拷贝Asset文件夹成功"
|
||||
}
|
||||
// 拷贝ProjectSettings文件夹
|
||||
def channelProjectSettingsPath = "${channelPath}/ProjectSettings"
|
||||
if (checkFolderExists(channelProjectSettingsPath)) {
|
||||
copyFolder(channelProjectSettingsPath, "$WORKSPACE/ProjectNLD/")
|
||||
echo "拷贝ProjectSettings文件夹成功"
|
||||
}
|
||||
// 拷贝PlayerSettings.txt文件
|
||||
copyFile(defineListPath, "$WORKSPACE/ProjectNLD/PlayerSettings.txt")
|
||||
echo "拷贝PlayerSettings.txt文件成功"
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
echo "copy local env file to ${WORKSPACE}"
|
||||
sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/BuildTool/"
|
||||
echo "make shell executable"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/build_iOS_debug.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/update_build_resource_debug.sh"
|
||||
echo "execute build shell"
|
||||
script {
|
||||
try{
|
||||
if(params.Debug_AllLocal == true)
|
||||
PROFILE_PARAM="AllLocal"
|
||||
if(params.Enable_Hot_Update == true)
|
||||
Enable_Hot_Update = "true"
|
||||
if(params.Build_InitApp == false)
|
||||
build_result=sh(script: "$WORKSPACE/Tool/BuildTool/update_build_resource_debug.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${params.Channel} ${Enable_Hot_Update} ${ARTIFACT_URL}", returnStatus: true, returnStdout: false)
|
||||
else
|
||||
build_result=sh(script: "$WORKSPACE/Tool/BuildTool/build_iOS_debug.sh ${VERSION_PARAM} ${PROFILE_PARAM} ${ARTIFACT_URL} ${Enable_Hot_Update} ${params.DebugBuild} ${params.Channel} ", returnStatus: true, returnStdout: false)
|
||||
if(build_result != 0)
|
||||
{
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/build.log" , followSymlinks: false
|
||||
error("Failure of the '打包' stage")
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传资源') {
|
||||
steps {
|
||||
echo "上传"
|
||||
echo "make shell executable"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/upload_to_server.sh"
|
||||
echo "execute build shell"
|
||||
script {
|
||||
if(params.Build_InitApp == false){
|
||||
sh "$WORKSPACE/Tool/BuildTool/upload_to_server.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${params.Channel} fasle"
|
||||
}
|
||||
else{
|
||||
sh "$WORKSPACE/Tool/BuildTool/upload_to_server.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${params.Channel} true"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('导出IPA') {
|
||||
steps {
|
||||
echo "生成IPA"
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/build_xcode.sh"
|
||||
sh "$WORKSPACE/Tool/BuildTool/build_xcode.sh ${PROJECT_NAME} ${SCHEME_NAME} ${PLATFORM_PARAM} ${VERSION_PARAM}"
|
||||
}
|
||||
else {
|
||||
echo "增量更新不需要导出IPA"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('上传IPA') {
|
||||
steps {
|
||||
echo "上传IPA"
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/upload_ipa.sh"
|
||||
sh "$WORKSPACE/Tool/BuildTool/upload_ipa.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${params.Channel}"
|
||||
}
|
||||
else {
|
||||
echo "增量更新不需要上传IPA"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('归档') {
|
||||
steps {
|
||||
echo "归档"
|
||||
script {
|
||||
try{
|
||||
if (params.Build_InitApp == true) {
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.ipa" , followSymlinks: false
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/build.log" , followSymlinks: false
|
||||
} else {
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/UpdatePreviousBuild.log" , followSymlinks: false
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('通知') {
|
||||
steps {
|
||||
echo "通知"
|
||||
sh "chmod +x $WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh"
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【${PROFILE_PARAM}】客户端打包上传成功!下载IPA链接:${ARTIFACT_URL}"
|
||||
sh "$WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh ${message}"
|
||||
} else {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【${PROFILE_PARAM}】客户端Addressable增量更新上传成功!下载IPA链接:${ARTIFACT_URL}"
|
||||
sh "$WORKSPACE/Tool/BuildTool/to_inner_wechat_robot.sh ${message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>items</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>assets</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>kind</key>
|
||||
<string>software-package</string>
|
||||
<key>url</key>
|
||||
<string>https://www.simplewow.xyz/ProjectA.ipa</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>metadata</key>
|
||||
<dict>
|
||||
<key>bundle-identifier</key>
|
||||
<string>com.phxh.Try</string>
|
||||
<key>bundle-version</key>
|
||||
<string>0.1.0(0)</string>
|
||||
<key>kind</key>
|
||||
<string>software</string>
|
||||
<key>title</key>
|
||||
<string>ProjectA</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 使用 ossutil 上传至服务器
|
||||
# 上传参数 VERSION(版本) PLATFORM(平台) CHANNEL(渠道) DIR_PATH(文件路径)
|
||||
# 传入资源文件夹路径模版 DIR_PATH="../../$PROJECT_NAME/ServerData/$PLATFORM/"
|
||||
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# Source the local environment
|
||||
if [ -f ./local_env.sh ]; then
|
||||
source ./local_env.sh
|
||||
echo "found the local_env file"
|
||||
fi
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
PLATFORM="$1"
|
||||
CHANNEL="$2"
|
||||
DIR_PATH="$3"
|
||||
|
||||
# 获取服务器路径
|
||||
REMOTE_PATH="$OSS_REMOTE_UPLOAD_PATH/Build/$CHANNEL/$PLATFORM/"
|
||||
|
||||
echo "remote path : $REMOTE_PATH"
|
||||
|
||||
# 检查服务器上的文件夹是否存在
|
||||
"$OSSUTIL_PATH" ls "$REMOTE_PATH" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Remote Create $REMOTE_PATH .."
|
||||
"$OSSUTIL_PATH" mkdir "$REMOTE_PATH"
|
||||
fi
|
||||
|
||||
# 判断DIR_PATH是文件还是目录 -f强制覆盖同名文件
|
||||
if [ -d "$DIR_PATH" ]; then
|
||||
echo "dir : $DIR_PATH"
|
||||
"$OSSUTIL_PATH" cp -r "$DIR_PATH" "$REMOTE_PATH" -f
|
||||
elif [ -f "$DIR_PATH" ]; then
|
||||
echo "file : $DIR_PATH"
|
||||
"$OSSUTIL_PATH" cp "$DIR_PATH" "$REMOTE_PATH" -f
|
||||
else
|
||||
echo "Error: $DIR_PATH is neither a file nor a directory. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
upload_result=$?
|
||||
|
||||
if [ $upload_result -eq 0 ]; then
|
||||
echo "Build uploaded to remote server successfully."
|
||||
else
|
||||
sh to_inner_wechat_robot.sh "【$PLATFORM】【$PROFILE】Failed to upload build to remote server! "
|
||||
echo "Failed to upload build to remote server."
|
||||
fi
|
||||
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 使用 ossutil 上传至服务器
|
||||
# 上传参数 VERSION(版本) PLATFORM(平台) CHANNEL(渠道) DIR_PATH(文件路径)
|
||||
# 传入资源文件夹路径模版 DIR_PATH="../../$PROJECT_NAME/ServerData/$PLATFORM/"
|
||||
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# Source the local environment
|
||||
if [ -f ./local_env.sh ]; then
|
||||
source ./local_env.sh
|
||||
echo "found the local_env file"
|
||||
fi
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
PLATFORM="$2"
|
||||
CHANNEL="$3"
|
||||
DIR_PATH="$4"
|
||||
|
||||
# 获取服务器路径
|
||||
REMOTE_PATH="$OSS_REMOTE_UPLOAD_PATH/Build/$CHANNEL/$PLATFORM/$VERSION/"
|
||||
|
||||
echo "remote path : $REMOTE_PATH"
|
||||
|
||||
# 检查服务器上的文件夹是否存在
|
||||
"$OSSUTIL_PATH" ls "$REMOTE_PATH" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Remote Create $REMOTE_PATH .."
|
||||
"$OSSUTIL_PATH" mkdir "$REMOTE_PATH"
|
||||
fi
|
||||
|
||||
# 判断DIR_PATH是文件还是目录 -f强制覆盖同名文件
|
||||
if [ -d "$DIR_PATH" ]; then
|
||||
echo "dir : $DIR_PATH"
|
||||
"$OSSUTIL_PATH" cp -r "$DIR_PATH" "$REMOTE_PATH" -f
|
||||
elif [ -f "$DIR_PATH" ]; then
|
||||
echo "file : $DIR_PATH"
|
||||
"$OSSUTIL_PATH" cp "$DIR_PATH" "$REMOTE_PATH" -f
|
||||
else
|
||||
echo "Error: $DIR_PATH is neither a file nor a directory. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
upload_result=$?
|
||||
|
||||
if [ $upload_result -eq 0 ]; then
|
||||
echo "Build uploaded to remote server successfully."
|
||||
else
|
||||
sh to_inner_wechat_robot.sh "【$PLATFORM】【$VERSION】【$PROFILE】Failed to upload build to remote server! "
|
||||
echo "Failed to upload build to remote server."
|
||||
fi
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#项目相关参数
|
||||
|
||||
# 打包文件名
|
||||
BUILD_NAME="NLDBuild"
|
||||
|
||||
# App 名字
|
||||
APP_NAME="雪松"
|
||||
|
||||
# 项目名称
|
||||
PROJECT_NAME="ProjectNLD"
|
||||
|
||||
# 服务器管理员
|
||||
REMOTE_USER="root"
|
||||
|
||||
# 服务器地址
|
||||
REMOTE_HOST="132.232.113.98"
|
||||
|
||||
# 内部OSS服务器地址
|
||||
OSS_REMOTE_UPLOAD_PATH="oss://nld-test/client_res"
|
||||
|
||||
# 服务器上传资源路径
|
||||
REMOTE_UPLOAD_PATH="/var/www/html/nld/Build"
|
||||
|
||||
# 内部机器人地址
|
||||
INNER_ROBOT="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
|
||||
|
||||
# 外部机器人地址 - PHXH
|
||||
OUTER_ROBOT_PHXH="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=08abd6b7-67be-421b-8f9b-9bc1b2c71150"
|
||||
|
||||
# 外部机器人地址 - NLD委员会
|
||||
OUTER_ROBOT_NLD="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cc0e1316-dd10-4845-b067-5693f2385f66"
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
PLATFORM="$2"
|
||||
|
||||
cd "../../Builds/$PLATFORM/$VERSION/"
|
||||
|
||||
IAP_APP_NAME="$APP_NAME.ipa"
|
||||
|
||||
IAP_BUILD_NAME="$BUILD_NAME.ipa"
|
||||
|
||||
# 复制 IAP_NAME 并重命名为 BUILD_NAME
|
||||
if [ -f "$IAP_APP_NAME" ]; then
|
||||
cp "$IAP_APP_NAME" "$IAP_BUILD_NAME"
|
||||
else
|
||||
echo "Error: $IAP_APP_NAME does not exist."
|
||||
fi
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
# Check if exactly one arguments are provided
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <message>"
|
||||
echo "current param count : $#"
|
||||
exit 1
|
||||
fi
|
||||
# Assign the input arguments to variables
|
||||
MSG_TEXT="$1"
|
||||
echo "$MSG_TEXT"
|
||||
|
||||
sh to_wechat_robot.sh "$INNER_ROBOT" "@all" "$MSG_TEXT"
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
# Check if exactly one arguments are provided
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <message>"
|
||||
echo "current param count : $#"
|
||||
exit 1
|
||||
fi
|
||||
# Assign the input arguments to variables
|
||||
MSG_TEXT="$1"
|
||||
echo "$MSG_TEXT"
|
||||
|
||||
# PHXH
|
||||
sh to_wechat_robot.sh "$OUTER_ROBOT_PHXH" "@all" "$MSG_TEXT"
|
||||
# NLD委员会
|
||||
sh to_wechat_robot.sh "$OUTER_ROBOT_NLD" "@all" "$MSG_TEXT"
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#!/bin/bash
|
||||
# Check if exactly one arguments are provided
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "Usage: $0 <note url> <mentioned list> <msg text>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Assign the input arguments to variables
|
||||
NOTE_URL="$1"
|
||||
MENTIONED_LIST="$2"
|
||||
MSG_TEXT="$3"
|
||||
|
||||
echo "to wechat param : NOTE_URL=$NOTE_URL, MENTIONED_LIST=$MENTIONED_LIST, MSG_TEXT=$MSG_TEXT"
|
||||
|
||||
|
||||
MESSAGE="{
|
||||
\"msgtype\": \"text\",
|
||||
\"text\": {
|
||||
\"content\": \""$MSG_TEXT"\",
|
||||
\"mentioned_list\":[\"$MENTIONED_LIST\"]
|
||||
}
|
||||
}"
|
||||
|
||||
echo "$MESSAGE"
|
||||
|
||||
# Use curl to send a POST request with the message
|
||||
curl -X POST "$NOTE_URL" -H 'Content-Type: application/json' -d "$MESSAGE"
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# Source the local environment
|
||||
if [ -f ./local_env.sh ]; then
|
||||
source ./local_env.sh
|
||||
echo "found the local_env file"
|
||||
fi
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
PLATFORM="$2"
|
||||
PROFILE="$3"
|
||||
CHANNEL="$4"
|
||||
ENABLE_HOT_UPDATE="$5"
|
||||
ARTIFACT_URL="$6"
|
||||
|
||||
|
||||
# Set if needs to clear cache
|
||||
CLEARCACHED="yes"
|
||||
#CLEARCACHED="no"
|
||||
|
||||
BUILD_FOLDER="../../Builds/$PLATFORM/$VERSION" #相对脚本路径
|
||||
EXECUTE_METHOD="BatchBuild.UpdatePreviousBuild"
|
||||
LOG_FILE="$BUILD_FOLDER/UpdatePreviousBuild.log" #相对脚本路径
|
||||
|
||||
echo "Start update previous building ... ..."
|
||||
|
||||
"$UNITY_PATH" -quit -batchmode -projectPath "../../$PROJECT_NAME" -executeMethod "$EXECUTE_METHOD" \
|
||||
-platform "$PLATFORM" \
|
||||
-profile "$PROFILE" \
|
||||
-appVersion "$VERSION" \
|
||||
-clearCached "$CLEARCACHED" \
|
||||
-channel "$CHANNEL" \
|
||||
-enableHotUpdate "$ENABLE_HOT_UPDATE" \
|
||||
-logFile "$LOG_FILE"
|
||||
|
||||
build_result=$?
|
||||
|
||||
if [ $build_result -ne 0 ]; then
|
||||
echo "Update build failed. Check the log for details."
|
||||
sh to_inner_wechat_robot.sh "【$PLATFORM】【$VERSION】【$PROFILE】Failed to Update a previous build Addressable, Check the log for details:$ARTIFACT_URL"
|
||||
sh collect_and_send_error.sh $LOG_FILE
|
||||
exit 1
|
||||
else
|
||||
echo " Update a previous build successful! !"
|
||||
fi
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
PLATFORM="$1"
|
||||
WORKSPACE="$2"
|
||||
VERSION="$3"
|
||||
|
||||
APK_NAME="$BUILD_NAME.apk"
|
||||
|
||||
REMOTE_PATH="/$REMOTE_UPLOAD_PATH/$WORKSPACE/$PLATFORM/"
|
||||
echo "upload folder is: ${REMOTE_PATH}"
|
||||
echo "remote host is: $REMOTE_HOST"
|
||||
ssh "$REMOTE_USER@$REMOTE_HOST" "mkdir -p $REMOTE_PATH"
|
||||
|
||||
cd "../../Builds/$PLATFORM/$VERSION/"
|
||||
# 输出当前路径
|
||||
pwd
|
||||
|
||||
echo "uploading apk to remote server..."
|
||||
echo "scp ${APK_NAME} $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
scp "${APK_NAME}" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
|
||||
|
||||
upload_result=$?
|
||||
|
||||
if [ $upload_result -eq 0 ]; then
|
||||
echo "apk uploaded to remote server successfully."
|
||||
|
||||
else
|
||||
echo "Failed to upload apk to remote server."
|
||||
fi
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
PLATFORM="$2"
|
||||
WORKSPACE="$3"
|
||||
|
||||
REMOTE_PATH="$REMOTE_UPLOAD_PATH/$WORKSPACE/$PLATFORM/"
|
||||
echo "upload folder is: ${REMOTE_PATH}"
|
||||
|
||||
IAP_NAME="$BUILD_NAME.ipa"
|
||||
# IAP_NAME="雪松.ipa"
|
||||
|
||||
ssh "$REMOTE_USER@$REMOTE_HOST" "mkdir -p $REMOTE_PATH"
|
||||
|
||||
scp nld_self_host_ipa.plist "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
|
||||
cd "../../Builds/$PLATFORM/$VERSION/"
|
||||
|
||||
echo "uploading ipa to remote server..."
|
||||
echo "scp ${IAP_NAME} $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
scp "${IAP_NAME}" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
|
||||
|
||||
upload_result=$?
|
||||
|
||||
if [ $upload_result -eq 0 ]; then
|
||||
echo "ipa uploaded to remote server successfully."
|
||||
|
||||
else
|
||||
echo "Failed to upload ipa to remote server."
|
||||
fi
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
##!/bin/bash
|
||||
SHELL_DIR=$(dirname $0)
|
||||
echo "change dir to $SHELL_DIR"
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
# Source the local environment
|
||||
if [ -f ./local_env.sh ]; then
|
||||
source ./local_env.sh
|
||||
echo "found the local_env file"
|
||||
fi
|
||||
|
||||
# 获取项目相关参数
|
||||
if [ -f ./project_env.sh ]; then
|
||||
source ./project_env.sh
|
||||
echo "found the project_env file"
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
PLATFORM="$2"
|
||||
WORKSPACE="$3"
|
||||
NEWASSETS="$4"
|
||||
|
||||
REMOTE_PATH="/$REMOTE_UPLOAD_PATH/$WORKSPACE/$PLATFORM/$VERSION/"
|
||||
|
||||
echo "remote path : $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
|
||||
# Set remote Build Path (local) (modify as needed)
|
||||
BUILD_PATH="../../$PROJECT_NAME/ServerData/$PLATFORM/"
|
||||
|
||||
# Check if NEWASSETS is true, if so, delete existing assets on remote server
|
||||
#if [ "$NEWASSETS" = "true" ]; then
|
||||
# ssh "$REMOTE_USER@$REMOTE_HOST" "rm -rf $REMOTE_PATH/*"
|
||||
#fi
|
||||
|
||||
echo "build path : $BUILD_PATH"
|
||||
|
||||
cd $BUILD_PATH
|
||||
|
||||
echo "start ls ------------------------- no ls cannot resync why?"
|
||||
|
||||
ls
|
||||
|
||||
echo "start rsync -------------------------"
|
||||
|
||||
rsync -avz --progress -e ssh ./ $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH
|
||||
|
||||
cd "$SHELL_DIR"
|
||||
|
||||
#tar -czvf upload.tgz -C "$BUILD_PATH" .
|
||||
#ssh "$REMOTE_USER@$REMOTE_HOST" "mkdir -p $REMOTE_PATH"
|
||||
#scp upload.tgz "$REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH"
|
||||
#ssh "$REMOTE_USER@$REMOTE_HOST" "cd $REMOTE_PATH;tar -xzvf upload.tgz;rm -rf upload.tgz"
|
||||
|
||||
upload_result=$?
|
||||
|
||||
if [ $upload_result -eq 0 ]; then
|
||||
echo "Build uploaded to remote server successfully."
|
||||
|
||||
else
|
||||
sh to_inner_wechat_robot.sh "【$PLATFORM】【$VERSION】【$PROFILE】Failed to upload build to remote server! "
|
||||
echo "Failed to upload build to remote server."
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
// 对应管线任务参数
|
||||
def PLATFORM_PARAM = "iOS"
|
||||
def PROFILE_PARAM = "Debug"
|
||||
def IPA_NAME = "NLDBuild.ipa"
|
||||
def AAB_PARAM = "fasle"
|
||||
|
||||
// 构建时候的参数
|
||||
def VERSION_PARAM = params.VERSION
|
||||
def CHANNEL_PARAM = params.Channel
|
||||
def DEBUGBUILD_PARAM = params.DebugBuild
|
||||
def HOTUPDATE_PARAM = params.Enable_Hot_Update
|
||||
|
||||
// Jenkins 归档地址
|
||||
def ARTIFACT_URL = "http://${env.PHXH_BUILDER_IP_ADDRESS}:8080/job/${env.JOB_NAME}/"
|
||||
// 构建地址
|
||||
def BUILD_PATH = "Builds/$PLATFORM_PARAM/$VERSION_PARAM"
|
||||
// 日志地址
|
||||
def log_path="$BUILD_PATH/build.log"
|
||||
// xcode 项目相关参数
|
||||
def PROJECT_NAME = "Unity-iPhone"
|
||||
def SCHEME_NAME = "Unity-iPhone"
|
||||
|
||||
def SendMessageToWechat(message){
|
||||
def INNER_ROBOT="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3c92758c-1128-4931-ac8d-f19669d7befe"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/send_wechat_message.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/send_wechat_message.sh '${INNER_ROBOT}' '@all' '${message}'"
|
||||
}
|
||||
|
||||
def GetRemote()
|
||||
{
|
||||
if('Banshu' == params.Channel)
|
||||
return 'shenhe';
|
||||
else if('Official' == params.Channel)
|
||||
return 'main'
|
||||
else if('TapTap' == params.Channel)
|
||||
return 'main'
|
||||
else
|
||||
return 'stable_dev';
|
||||
}
|
||||
|
||||
def IsOSS()
|
||||
{
|
||||
if('Official' == params.Channel)
|
||||
return true;
|
||||
else if('TapTap' == params.Channel)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
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 = GetRemote();
|
||||
checkout scmGit(branches: [[name: "*/${remote}"]],
|
||||
extensions: [checkoutOption(60), 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']])
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('获取项目配置') {
|
||||
steps {
|
||||
// 将项目相关配置复制到打包路径下
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/copy_env.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/copy_env.sh $WORKSPACE/Tool/build_env"
|
||||
|
||||
// 将打包机器相关配置复制到打包路径下
|
||||
echo "copy local env file to $WORKSPACE"
|
||||
sh "cp /Users/mayuanzheng/Builds/local_env.sh $WORKSPACE/Tool/build_tools/"
|
||||
}
|
||||
}
|
||||
stage('根据渠道修改工程') {
|
||||
steps {
|
||||
echo "根据 [${CHANNEL_PARAM}] 渠道修改工程"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/modify_project_by_channel.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/modify_project_by_channel.sh $WORKSPACE ${CHANNEL_PARAM}"
|
||||
}
|
||||
}
|
||||
stage('打包') {
|
||||
steps {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/build_unity.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/hot_update.sh"
|
||||
|
||||
script {
|
||||
def build_result
|
||||
if(params.Debug_AllLocal == true)
|
||||
PROFILE_PARAM="AllLocal"
|
||||
|
||||
if(params.Build_InitApp == false){
|
||||
build_result=sh(script: "$WORKSPACE/Tool/build_tools/hot_update.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${PROFILE_PARAM} ${CHANNEL_PARAM} ${HOTUPDATE_PARAM}", returnStatus: true, returnStdout: false)
|
||||
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)
|
||||
|
||||
// 打包失败
|
||||
if(build_result != 0)
|
||||
{
|
||||
// 归档日志
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/parse_unity_build_log_error.sh"
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/parse_unity_build_log_exception.sh"
|
||||
|
||||
// 根据日志获取异常和报错返回信息
|
||||
def parse_log = "../../$log_path"
|
||||
def output_error = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log_error.sh ${parse_log} true", returnStdout: true).trim()
|
||||
def output_exception = sh(script: "${WORKSPACE}/Tool/build_tools/parse_unity_build_log_exception.sh ${parse_log} true", returnStdout: true).trim()
|
||||
|
||||
SendMessageToWechat(output_exception)
|
||||
SendMessageToWechat(output_error)
|
||||
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】构建失败"
|
||||
SendMessageToWechat(message)
|
||||
|
||||
error("Failure of the '打包' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('上传资源') {
|
||||
steps {
|
||||
script {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/upload_rsync.sh"
|
||||
def asset_path="$WORKSPACE/ProjectNLD/ServerData/${PLATFORM_PARAM}"
|
||||
def upload_path="${CHANNEL_PARAM}/${PLATFORM_PARAM}/${VERSION_PARAM}"
|
||||
def upload_result
|
||||
if(IsOSS())
|
||||
upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${CHANNEL_PARAM} ${asset_path} ${upload_path}", returnStatus: true, returnStdout: false)
|
||||
else
|
||||
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}】【Release】【${CHANNEL_PARAM}】上传资源失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传资源' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('导出IPA') {
|
||||
steps {
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/build_xcode_xcodeproj.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/build_xcode_xcodeproj.sh ${PROJECT_NAME} ${SCHEME_NAME} ${PLATFORM_PARAM} ${VERSION_PARAM}"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('重命名IPA') {
|
||||
steps {
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
sh "chmod +x $WORKSPACE/Tool/build_tools/rename_ipa.sh"
|
||||
sh "$WORKSPACE/Tool/build_tools/rename_ipa.sh ${VERSION_PARAM} ${PLATFORM_PARAM}"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('上传IPA') {
|
||||
steps {
|
||||
script {
|
||||
// 增量更新不需要上传包体
|
||||
if (params.Build_InitApp == true){
|
||||
def ipa_path="$WORKSPACE/Builds/$PLATFORM_PARAM/$VERSION_PARAM/$IPA_NAME"
|
||||
def upload_path="${CHANNEL_PARAM}/${PLATFORM_PARAM}"
|
||||
def upload_result
|
||||
if(IsOSS())
|
||||
upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_oss.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${CHANNEL_PARAM} ${ipa_path} ${upload_path}", returnStatus: true, returnStdout: false)
|
||||
else
|
||||
upload_result=sh(script: "$WORKSPACE/Tool/build_tools/upload_rsync.sh ${VERSION_PARAM} ${PLATFORM_PARAM} ${CHANNEL_PARAM} ${ipa_path} ${upload_path}", returnStatus: true, returnStdout: false)
|
||||
if(upload_result != 0)
|
||||
{
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】上传IPA失败"
|
||||
SendMessageToWechat(message)
|
||||
error("Failure of the '上传ipa' stage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('归档') {
|
||||
steps {
|
||||
script {
|
||||
try{
|
||||
archiveArtifacts artifacts: "$log_path" , followSymlinks: false
|
||||
if (params.Build_InitApp == true)
|
||||
archiveArtifacts artifacts: "$BUILD_PATH/*.ipa" , followSymlinks: false
|
||||
}
|
||||
catch(Exception e){
|
||||
SendMessageToWechat(e.message + "\r\n" + e.stackTrace)
|
||||
currentBuild.result = 'FAILURE'
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('通知') {
|
||||
steps {
|
||||
script {
|
||||
if (params.Build_InitApp == true) {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】客户端打包上传成功!下载链接:${ARTIFACT_URL}"
|
||||
SendMessageToWechat(message)
|
||||
} else {
|
||||
def message = "【${PLATFORM_PARAM}】【${VERSION_PARAM}】【Release】【${CHANNEL_PARAM}】客户端增量更新上传成功!下载链接:${ARTIFACT_URL}"
|
||||
SendMessageToWechat(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue