Jenkins持续化构建iOS心得

安装JDK和Jenkins步骤省略...

参考文章

https://blog.csdn.net/jifaliwo123/article/details/79277426

其他记录

General设置

Git源码设置
触发构建器设置

构建环境设置

构建(重点)

  • step1:


    打包构建shell代码
#!/bin/bash -l  
export LANG=en_US.UTF-8  
export LANGUAGE=en_US.UTF-8  
export LC_ALL=en_US.UTF-8  
  
pod install --verbose --no-repo-update  
  
#构建  
xcodebuild -archivePath "/Users/tiger/.jenkins/workspace/小灯塔_iOS_ci-beta/build/Debug-iphoneos/小灯塔.xcarchive" -workspace 小灯塔.xcworkspace -sdk iphoneos -scheme "小灯塔" -configuration "Release.Adhoc" archive

xcodebuild -exportArchive -archivePath "/Users/tiger/.jenkins/workspace/小灯塔_iOS_ci-beta/build/Debug-iphoneos/小灯塔.xcarchive" -exportPath "/Users/tiger/.jenkins/workspace/小灯塔_iOS_ci-beta/build/小灯塔_debug" -exportOptionsPlist '/Users/tiger/.jenkins/workspace/小灯塔_iOS_ci-beta/build/ExportOptions.plist' -allowProvisioningUpdates
  • step2


    上传到蒲公英
# 通过api上传到蒲公英当中
echo "===上传至蒲公英平台==="

# 蒲公英userkey
pgyerUserKey="xxx"
# 蒲公英apiKey
pgyerApiKey="xxx"

#指定ipa输出地址
project_path=$(pwd)
#指定项目名
project_name="小灯塔"
#描述信息
des=`cat ci-beta-description.txt`
echo "des:+$des"

ipa_path="${project_path}/build/小灯塔_debug"

if [ -e ${ipa_path}/${project_name}.ipa ]; then

    RESULT=$(curl -F "_api_key=${pgyerApiKey}" \
    -F "file=@${ipa_path}/${project_name}.ipa" \
    -F "buildInstallType=2" \
    -F "buildPassword=1230" \
    -F "buildUpdateDescription=${des}" \
    https://www.pgyer.com/apiv2/app/upload)

    # echo ${RESULT}
    if [ "${RESULT}" ]; then
        echo "===完成蒲公英平台上传==="
    else
        echo "===上传蒲公英平台失败==="
    fi
    # open ${ipa_path}
else
    echo "===上传蒲公英平台失败==="
fi

构建后的操作

构建后操作

你可能感兴趣的:(Jenkins持续化构建iOS心得)