#!/bin/bash
cd desktop
ipa=/Users/ljq/Desktop/path/merchant.ipa #打包后ipa存储目录
plistPath=/Users/ljq/Desktop/path #打包后plist存储目录
targetName=targetName #项目名称
targetPath=/Users/ljq/Desktop/targetName #项目路径
svnHttps=svnPath #svn下载项目路径
#plist文件需要修改的参数
url=ipaDownloadPath #ipa下载路径
identifier=com.xxxxxxxx #bundle-identifier
version=6.6 #bundle-version
title=title #title
svn checkout ${svnHttps} #svn下载项目文件
cd $targetPath
/usr/bin/xcodebuild -target $targetName clean #清理工程
/usr/bin/xcodebuild -target $targetName #打包.app
/usr/bin/xcrun -sdk iphoneos PackageApplication -v build/Release-iphoneos/$targetName.app -o $ipa # 打包.ipa
#rmdir xxxx #删除文件夹
cd $plistPath
#生成plist文件
cat << EOF > $targetName.plist
<?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>$identifier</string>
<key>bundle-version</key>
<string>$version</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>$title</string>
</dict>
</dict>
</array>
</dict>
</plist>
EOF
rm -rdf build #delete build
cd desktop
ipa=/Users/ljq/Desktop/path/merchant.ipa #打包后ipa存储目录
plistPath=/Users/ljq/Desktop/path #打包后plist存储目录
targetName=targetName #项目名称
targetPath=/Users/ljq/Desktop/targetName #项目路径
svnHttps=svnPath #svn下载项目路径
#plist文件需要修改的参数
url=ipaDownloadPath #ipa下载路径
identifier=com.xxxxxxxx #bundle-identifier
version=6.6 #bundle-version
title=title #title
svn checkout ${svnHttps} #svn下载项目文件
cd $targetPath
/usr/bin/xcodebuild -target $targetName clean #清理工程
/usr/bin/xcodebuild -target $targetName #打包.app
/usr/bin/xcrun -sdk iphoneos PackageApplication -v build/Release-iphoneos/$targetName.app -o $ipa # 打包.ipa
#rmdir xxxx #删除文件夹
cd $plistPath
#生成plist文件
cat << EOF > $targetName.plist
<?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>$identifier</string>
<key>bundle-version</key>
<string>$version</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>$title</string>
</dict>
</dict>
</array>
</dict>
</plist>
EOF
rm -rdf build #delete build