iOS开发技巧

iOS开发之——jenkins配置项目

2018-05-09  本文已影响2人  天空像天空一样蓝
配置项目

要是当前电脑没有安装jenkins可以看iOS开发之——jenkins安装

  1. 创建任务

登录jenkins。选择-->新建任务
任务名字可以是我们的项目名字,然后选择第一个就可以,点击确定新建完成


新建任务

确定之后直接跳入--配置页面。
也可以去首页看我们创建的任务


Test3
  1. 配置中心

点击 "Test3"--> ”配置“ --> 我们需要配置的任务计入配置


任务
  1. 配置-->General

描述:可以写我们打包的描述


General
  1. 源码配置

由于代码在gitlab上,这里选中Git(要是没有可以去安装插件)
Repository URL:代码的gitlab地址
Credentials: gitlab的登录名和密码(要是当前电脑配置过可以不写)
Branch Specifier: 需要打包的分支


源码配置.png
  1. 构建触发器

此处主要是我们打包的时间,这里是每天的12点打包(科=根据需要自己定义)


构建触发器.png
  1. 构建环境

要是我们要用Xcode打包的话需要在这里配置,本文用的是shell脚本所以没有设置


构建环境
  1. 构建

此处在下拉框中选择shell


shell构建
#!/bin/sh
#计时
SECONDS=0
#脚本所在目录
script_path="/Users/用户名/.jenkins/workspace/Test2"
#$(dirname "$0")
#当前时间
now=$(date +"%Y_%m_%d_%H_%M")
#包的moudle 0 debug 1 release 2 adhoc
moudle="0"
#工程名
scheme="工程名"

#证书
CODE_SIGN_IDENTITYFIER="证书"
#描述文件
provisioning_profile="描述文件"
#指定打包的配置名 Debug Ad-hoc Release
configuration="Debug"
#导出ipa的类型
exportOptionsPlist='ExportOptions.plist'

#指定项目地址
workspace_path="项目.xcworkspace"
#输出路径
output_path="/Users/用户名/Documents/IPA"
#archive归档地址
archive_path="$output_path/${scheme}_Archive/${scheme}_${configuration}_${now}.xcarchive"
#ipa_path
ipa_path="$output_path/${scheme}_${configuration}"

echo "====================clean===================="
xcodebuild clean -workspace ${workspace_path} -scheme ${scheme} -configuration ${configuration}
echo "====================clean success===================="
#
echo "====================archive===================="
xcodebuild build -workspace ${workspace_path} -scheme ${scheme} -configuration ${configuration} archive -archivePath ${archive_path} CODE_SIGN_IDENTITY="${CODE_SIGN_IDENTITYFIER}" PROVISIONING_PROFILE="${provisioning_profile}"

echo "====================export===================="
#导出ipa包
xcodebuild -exportArchive -archivePath ${archive_path} -exportPath ${ipa_path} -exportOptionsPlist ${script_path}/${exportOptionsPlist}

  1. 构建后的操作

一般选择自己公司的平台可以fir、蒲公英等等

上一篇 下一篇

猜你喜欢

热点阅读