美文网首页
自动打包与部署

自动打包与部署

作者: demoker | 来源:发表于2016-05-05 16:18 被阅读280次

1.配置:在工程所在目录下PackageShell文件夹,其中包括一个package文件夹(存放打包后的相关文件)、PackageConfig文件夹(其中存放app的相关配置.plist)

2.运行.sh脚本:进入到所在文件夹下,然后./name.sh 敲回车,这样就运行了

3.脚本content:

#!/bin/sh
profile_Name=`/usr/libexec/PlistBuddy -c "print profile_Name" ./PackageConfig/xx.plist`
ipa_Name=`/usr/libexec/PlistBuddy -c "print app_Name" ./PackageConfig/xx.plist`
cd ../xxprojectName
echo "go to xxprojectName workspace path"
#
#buildDay=$(date +%Y%m%d)
buildTime=$(date +%Y%m%d%H%M)
profile="${profile_Name}"
echo $profile $ipa_Name
if [ ! -d "../PackageShell/Package" ]; then
mkdir ../PackageShell/Package
fi
if [ ! -d "../PackageShell/Package/ArchiveProduction" ]; then
mkdir ../PackageShell/Package/ArchiveProduction
fi
if [ ! -d "../PackageShell/Package/ArchiveProduction/QA" ]; then
mkdir ../PackageShell/Package/ArchiveProduction/QA
echo "Create ArchiveProduction path"
fi
if [ ! -d "../PackageShell/Package/ipa" ]; then
mkdir ../PackageShell/Package/ipa
fi
if [ ! -d "../PackageShell/Package/ipa/QA" ]; then
mkdir ../PackageShell/Package/ipa/QA
echo "Create ipa path"
fi
#
buildConfiguration="QA"
buildPath="../PackageShell/Package/ArchiveProduction/QA/${ipa_Name}_${buildTime}.xcarchive"
#ipaName="../PackageShell/Package/ipa/QA/${ipa_Name}_${buildTime}.ipa"
ipaName="../PackageShell/Package/ipa/QA/${ipa_Name}.ipa"
xctool -workspace xxprojectName.xcworkspace -scheme xxprojectName -configuration ${buildConfiguration} clean
xctool -workspace xxprojectName.xcworkspace -scheme xxprojectName -configuration ${buildConfiguration} archive -archivePath ${buildPath}
xcodebuild -exportArchive -exportFormat IPA -archivePath ${buildPath} -exportPath ${ipaName} -exportProvisioningProfile "$profile"

4.针对部署下面进行研究:

方式一:

使用curl 上传文件,示例代码如下:

#上传到蒲公英
curl -F "file=@"${ipaName} \
-F "uKey=7a293adb2ae692594483b846bfc4ddc8" \
-F "_api_key=9440f27246757ebc2b92286186b4690b" \
https://www.pgyer.com/apiv1/app/upload

方式二:

mattt大神的--SHENZHEN

安装:
$ gem install shenzhen

具体使用方法详见git

下面针对FIR、蒲公英和FTP给予使用说明:

FTP Distribution

$ ipa distribute:ftp --host HOST -u USER -p PASSWORD -P FTP_PATH

蒲公英 (PGYER)

$ ipa distribute:pgyer -u USER_KEY -a APP_KEY

FIR

$ ipa distribute:fir -u USER_TOKEN -a APP_ID

以上脚本中使用到xctool,xctool是facebook对xcodebuild的封装.本来想添加脚本到工程的script下,command+B直接编译之后就会执行脚本,但是这里暂时木有实现,有错误,暂时只能通过终端去执行.sh

参考blog:

iOS自动打包并发布脚本

iOS开发自动打包

iOS批量自动打包和部署(Ⅱ):自动打包

shenzhen

多渠道批量打包

相关文章

网友评论

      本文标题:自动打包与部署

      本文链接:https://www.haomeiwen.com/subject/ucmdrttx.html