Jenkins 搭建U3D自动发布 IOS

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( " " + "<string>" + PRDUCT_NAME + "</string>" + ' ' )
stepOneLine = True

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

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

if line == '<key>CFBundleVersion</key>':
info_plist.write( "<string>1.0</string>" + ' ' )
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