用 shell 脚本快速打包 iOS ipa 文件

#! /bin/bash
echo "~~~~~~ iOS workspace ipa 打包~~~~~"
# 需要配置的几个参数
provisioningProfileName="MACProject"

# step1  获取所在路径
filepath=$(cd "$(dirname "$0")"; pwd)

echo $filepath

# step2  编译自己的工程
#echo $provisioningProfileName
for i in $(ls $filepath)
do
   if [[ $i =~ ".xcworkspace" ]]
      then
      projectFile=$i
      projectName=${i%.*}
      break;
   fi
done

xcodebuild -workspace $projectFile -scheme $projectName -configuration Release

#step3 生成 .xcarchive
xcarchive=$filepath"/"$projectName".xcarchive"
echo $xcarchive
xcodebuild -workspace $projectFile -scheme $projectName archive -archivePath $xcarchive
#step4 导出 .ipa
ipaPath=$filepath"/"$projectName".ipa"
echo $ipaPath
xcodebuild -exportArchive -exportFormat ipa -archivePath $xcarchive -exportPath $ipaPath -exportProvisioningProfile $provisioningProfileName

你可能感兴趣的:(IOS)