Jenkins 搭建U3D自动发布 IOS

本文详细介绍使用Jenkins进行iOS应用自动化构建的过程,包括插件安装、源码管理配置、构建触发器设置、Shell脚本执行、Xcode工程导出IPA文件及无线分发配置。此外,还提供了用于修改info.plist文件的Python脚本示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://www.cnblogs.com/yinghuochong/archive/2013/09/01/3294940.html 

1.安装包,工具略过。

2.插件管理 

 

This plugin adds the Subversion support (via SVNKit) to Jenkins.
This plugin will upload .ipa or .apk file(s) to  testflightapp.com for distribution.
This plugin provides builders to build xcode projects, invoke agvtool and package .ipa files
This plug-in adds reusable macro expansion capability for other plug-ins to use.
This plugin provides a new enhanced API for interacting with SCM systems.
Integrates Jenkins with CVS version control system using a modified version of the Netbeans cvsclient.
This plugin integrates  GIT with Jenkins.
 
3.新建项目开始配置步骤:

1>.源码管理 :SVN更新代码工程与资源 。

2>.构建触发器,可以不要 指定时间自己构建  Poll SCM  H 22 * * *  【每天22.00点自动构建一次】

3>.添加Execute Shell 步骤

cp $WORKSPACE/Tools/PostProcessBuildPlayer $WORKSPACE/code/Assets/Editor/
chmod +x $WORKSPACE/code/Assets/Editor/PostProcessBuildPlayer

rm -rf $WORKSPACE/build
mkdir -p $WORKSPACE/build

echo Start building Unity project to iOS project..........
/Applications/Unity/Unity.app/Contents/MacOS/Unity -projectPath $WORKSPACE/code -executeMethod PerformBuild.CommandLineBuild -batchmode -quit -logFile $WORKSPACE/build/log.txt

echo Copy resource to build directory.....
mkdir -p ${WORKSPACE}/build/iPhone/Data/ClientRes
cp -r ${WORKSPACE}/ClientRes/Config ${WORKSPACE}/build/iPhone/Data/ClientRes
cp -r ${WORKSPACE}/ClientRes/Assetbundles_Ios ${WORKSPACE}/build/iPhone/Data/ClientRes
rm -rf ${WORKSPACE}/build/iPhone/Data/ClientRes/Config/.svn
rm -rf ${WORKSPACE}/build/iPhone/Data/ClientRes/Assetbundles_Ios/.svn

python $WORKSPACE/Tools/updateInfo.py ${WORKSPACE}/build/iPhone 0.6 ${BUILD_NUMBER}

4>.Xcode 工程导出IPA。

5.

cd ${WORKSPACE}/build/distributes
mkdir -p DragonBone-0.6.${BUILD_NUMBER}
cp *.ipa DragonBone-0.6.${BUILD_NUMBER}\

# Generate .plist file for wireless app distribution
echo "<?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>__URL__</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>com.cdkoi.dragon</string>
<key>bundle-version</key>
<string>dragon 0.6.${BUILD_NUMBER}</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>Dragon Bone for iOS</string>
<key>subtitle</key>
<string>0.6.${BUILD_NUMBER}</string>
</dict>
</dict>
</array>
</dict>
</plist>" > "${WORKSPACE}/build/distributes/DragonBone-0.6.${BUILD_NUMBER}/app.plist";
cp -r ${WORKSPACE}/build/distributes/DragonBone-0.6.${BUILD_NUMBER} ~/distributes

 ===========updateInfo.py 内容===========

# -*- coding: utf-8 -*-
#!/usr/bin/python

import sys
import os

PRDUCT_NAME = "XXX"
CBundleIdentifier = "com.cdkoi.dragon"

def process_info(info_filename, product_name, bundle_version, build_version):
info_plist = open( info_filename, 'r' )
lines = info_plist.readlines()
info_plist.close()

info_plist = open( info_filename, 'w' )

# Now iterate through the project adding any new lines where needed
i = 0
stepOneLine = False
for i in range(0, len(lines)):
if stepOneLine == False:
line = lines[i]
info_plist.write(line)
stepOneLine = False

if line.strip() == "<key>CFBundleName</key>":
info_plist.write( "\t" + "<string>" + PRDUCT_NAME + "</string>" + '\n' )
stepOneLine = True

if line.strip() == "<key>CFBundleDisplayName</key>":
info_plist.write( "\t" + "<string>" + PRDUCT_NAME + "</string>" + '\n' )
stepOneLine = True

if line == '<key>CFBundleShortVersionString</key>':
info_plist.write( "<string>1.0</string>" + '\n' )
stepOneLine = True

if line == '<key>CFBundleVersion</key>':
info_plist.write( "<string>1.0</string>" + '\n' )
stepOneLine = True
else:
stepOneLine = False

info_plist.close()


# Script start
print "Starting Modify info.plist with the following arguments..."

i = 0
for args in sys.argv:
print str(i) +': ' + args
i += 1

# Check this is an iOS build before running
if len(sys.argv) == 4:

info_full_path_name = sys.argv[1] + '/info.plist'
process_info(info_full_path_name, "龙之骨", "1.0", "1.0")

转载于:https://www.cnblogs.com/j349900963/p/4417250.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值