Xcode自动化打包与蒲公英发布

Xcode自动化打包与蒲公英发布

workspace_path="工作区间目录"
scheme_name="scheme名字"
configuration="Debug/Release"
archive_path="archive文件路径"
certificate_name="证书名字"
provisioning_Profile_Name="授权文件名字"
bundleID="bundle ID"
exportFilePath="ipa包路径"
uKey="蒲公英userkey"
apiKey="蒲公英apikey"

#清理工程
xcodebuild clean  \
-workspace ${workspace_path} \
-scheme ${scheme_name} \
-configuration ${configuration} 

#编辑
xcodebuild archive -workspace ${workspace_path} \
    -scheme ${scheme_name} \
    -configuration ${configuration} \
    -archivePath ${archive_path} \
    CODE_SIGN_IDENTITY="${certificate_name}"  \
    PROVISIONING_PROFILE="${provisioning_Profile_Name}" \
    PRODUCT_BUNDLE_IDENTIFIER="${bundleID}" 
    
#打包
xcodebuild -exportArchive \
-archivePath ${archive_path} \
-configuration ${configuration} \
-exportPath ${exportFilePath} \
-exportOptionsPlist ${exportOptionsPlistPath}

#上传ipa到蒲公英
if [ -e ${exportFilePath} ]
then
    echo '开始上传ipa/apk到蒲公英'
    curl -F "file=@${exportFilePath}/${project_name}.ipa" -F "uKey=${uKey}" -F "_api_key=${apiKey}" 'https://www.pgyer.com/apiv1/app/upload' --verbose
else
    echo "在目录:${exportFilePath} 不存在"
fi

你可能感兴趣的:(xcode,自动化打包)