用个人证书Shell打包发布蒲公英。下面记录下主要步骤
1、shell脚本
#!/bin/sh
function setup_dir {
if [ -d "${BUILD_PATH}" ]; then
rm -rf "${BUILD_PATH}"
fi
mkdir -p "${BUILD_PATH}"
touch ${LOG_FILE}
}
function build_upload {
echo "---- Start building process"
# clean and archive
xcodebuild -project ${PROJECT} -scheme ${SCHEME} -configuration ${CONFIGURATION} -sdk iphoneos -xcconfig ${CONFIG_FILE} -archivePath ${ARCHIVE_FILE} clean archive >> ${LOG_FILE} 2>&1
echo "=== Archived project ${PROJECT} at ${ARCHIVE_FILE}"
# export
xcrun xcodebuild -exportArchive -exportOptionsPlist ${EXPORT_OPTIONS_FILE} -archivePath ${ARCHIVE_FILE} -exportPath ${EXPORT_PATH} >> ${LOG_FILE}
echo "IPA file size is 'du -h ${IPA_FILE} | cut -f1'" | tee -a ${LOG_FILE}
echo "=== Uploading to pgyer & fir now"
# upload to pgyer
curl -F "file=@${IPA_FILE}" -F "uKey=蒲公英的key" -F "_api_key=蒲公英的api——Key" -F "publishRange=2" http://www.pgyer.com/apiv1/app/upload >> ${LOG_FILE}
echo "upload success download 下载地址"
}
set -e
CONFIG_FILE="Scripts/ci/DeployConfig.xcconfig"
EXPORT_OPTIONS_FILE="Scripts/ci/ExportOptions.plist"
PROJECT="工程名字.xcodeproj"
SCHEME="工程名字"
CONFIGURATION="Release"
APP_NAME="工程名字"
BUILD_PATH="build/${SCHEME}"
LOG_FILE="${BUILD_PATH}/build.log"
ARCHIVE_FILE="${BUILD_PATH}/${APP_NAME}.xcarchive"
EXPORT_PATH="${BUILD_PATH}"
IPA_FILE="${EXPORT_PATH}/${APP_NAME}.ipa"
echo '--- start ---'
setup_dir
build_upload
echo '--- end ---'
DeployConfig.xcconfig
OTHER_LDFLAGS = -ObjC -all_load
ExportOptions.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>method</key>
<string>development</string>
<key>teamID</key>
<string>发布证书的ID</string>
<key>compileBitcode</key>
<false/>
<key>iCloudContainerEnvironment</key>
<string>Development</string>
<key>uploadSymbols</key>
<false/>
<key>uploadBitcode</key>
<false/>
</dict>
</plist>