Jenkins
Jenkins

Jenkins

安装Java

安装Jenkins

1. 下载安装

2. 命令行安装(Mac推荐)

重启电脑
jenkins start
http://localhost:8080/exit //退出Jenkins
http://localhost:8080/restart //重启
http://localhost:8080/reload //重新加载

3. 插件

 

更新gradle 配置文件 .bash_profile
source ~/.bash_profile
  • AnsiColor
  • Timestamp
  • Unity
  • XCode
  • Locale (中文插件)
    • 配置【Manage Jenkins】>【Configure System】> 【Locale】
      语言填 zh_CN
      勾选强制设置语言

4. 配置

archive the artifacts 匹配多个文件("," 符号隔开)
示例:
builds/${BUILD_NUMBER}/*.xml,builds/${BUILD_NUMBER}/*.zip,builds/${BUILD_NUMBER}/**/*.zip,builds/${BUILD_NUMBER}/**/*.obb,builds/${BUILD_NUMBER}/**/build/outputs/apk/debug/*.apk,builds/${BUILD_NUMBER}/**/build/outputs/apk/release/*.apk
 
Unity命令行示例
-quit  -batchmode  -projectPath  "${WORKSPACE}" -buildTarget ${platform} -executeMethod  GameBear.SmartBuild.Internal.SmartBuilderJenkins.Build -logFile "${WORKSPACE}/builds/${BUILD_NUMBER}/unity3d_defineSymbols.log"  -silent-crashes -bbBuildPath "${WORKSPACE}/builds/${BUILD_NUMBER}" -bbVersion ${version} -bbDevelopment ${development} -bbBundleIdentifier ${bundleIdentifier} -bbGenerateBundle ${generateBundle} -bbKeystoreName android_release.keystore -bbKeystorePass 123456 -bbIsSplit ${isObb} -bbIsBuildBundle ${isBuildBundle} -bbBundleVersion ${bundleVersion} -bbProductName ${productName} -bbDisableGm ${disableGm} -bbUsePdxLogin ${usePdxLogin} -bbEnableTuto ${enableTuto} -bbAutoLogin ${autoLogin} -bbPingServer ${pingServer} -bbEnableMusic ${enableMusic}
 
自动删除旧的归档文件
notion image
 
其他
配置全局变量:Manage Jenkins -> Configure System -> 全局属性 -> Environment
 
Please provide an auth token with USYM_UPLOAD_AUTH_TOKEN environment variable 问题修复
 
打包命令1
-quit  -batchmode  -projectPath  "${WORKSPACE}" -buildTarget ${platform} -executeMethod  GameBear.SmartBuild.Internal.SmartBuilderJenkins.PreBuild  -silent-crashes -bbAddSymbols AUTO_BUILD -bbConfigName ${configName} cat unity.log | grep error
命令2
-quit  -batchmode  -projectPath  "${WORKSPACE}" -buildTarget ${platform} -executeMethod  GameBear.SmartBuild.Internal.SmartBuilderJenkins.Build -logFile "${WORKSPACE}/builds/${BUILD_NUMBER}/unity3d_defineSymbols.log"  -silent-crashes -bbBuildPath "${WORKSPACE}/builds/${BUILD_NUMBER}" -bbVersion ${version} -bbDevelopment ${development} -bbGenerateBundle ${generateBundle} -bbKeystoreName android_release.keystore -bbKeystorePass 123456 -bbIsSplit ${isObb} -bbIsBuildBundle ${isBuildBundle} -bbBundleVersion ${bundleVersion} -bbDisableGm ${disableGm} -bbEnableTuto ${enableTuto} -bbAutoLogin ${autoLogin} -bbPingServer ${pingServer} -bbEnableMusic ${enableMusic} -bbConfigName ${configName} -bbCdnType ${cdnType} cat unity.log | grep error