第4次作业 -- 基于Jenkins的持续集成

Jenkins 配置使用心得

先在 https://jenkins.io/download/ 下载Jenkins

下载之后安装,在指定的地方找到了初始密码,安装了一些插件之后,Jenkins就可以使用了

配置的时候注意要装一个Github的插件,不然后面会失败

Jenkins 任务构建心得

出现错误的时候善用Google

官网上也有常见问题的解决方法

https://wiki.jenkins.io

任务执行方法

新建一个任务,输入Github的项目地址,验证身份之后,就可以持续集成了。

选择执行shell,然后输入下面的代码

APP_NAME="TestJenkins"
CODE_SIGN_DISTRIBUTION="iPhone Distribution: XXXXXXXXXX"
project_infoplist_path="./${APP_NAME}/Info.plist"

bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" "${project_infoplist_path}")
bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" "${project_infoplist_path}")
DATE="$(date +%Y%m%d)"
IPAFOLDER="${APP_NAME}_V${bundleShortVersion}_${DATE}"

ARCHIVE_PATH="${HOME}/Desktop/archive"
IPA_PATH="$ARCHIVE_PATH/${IPAFOLDER}/${APP_NAME}.ipa"
PLIST_PATH="$ARCHIVE_PATH/ADHocExportOptions.plist"
echo${IPA_PATH}
echo${PLIST_PATH}

xcodebuild archive -project"${APP_NAME}.xcodeproj"-scheme${APP_NAME}-archivePath"${ARCHIVE_PATH}/${APP_NAME}.xcarchive"

xcodebuild -exportArchive-archivePath"${ARCHIVE_PATH}/${APP_NAME}.xcarchive"-exportPath"$ARCHIVE_PATH/$IPAFOLDER"-exportOptionsPlist"$PLIST_PATH"

成功之后,Jenkins就开始自动构建项目了

执行结果分析

分析不出来qwq

猜你喜欢

转载自www.cnblogs.com/thirtiseven/p/10269723.html