
Homebrew
搜索
brew search jenkins
安装
brew install jenkins
执行
java -jar /usr/local/Cellar/jenkins/版本号/libexec/jenkins.war --httpPort=8080
启动jenkins: brew services start jenkins
停止jenkins: brew services stop jenkins
重启jenkins: brew services restart jenkins
查看jenkins: ps -ef | grep jenkins
卸载jenkins: brew uninstall jenkins
启动Jenkins
-
brew services start jenkins
-
打开网址:
localhost:8080

-
红色路径是Jenkins启动密码路径
进入访达
按住command
+shift
+g
将路径粘贴进入打开文件initialAdminPassword
复制密码填写到web位置 -
安装默认插件
1.jpeg
2.jpeg
3.jpeg
-
设置用户名与密码
用户设置.jpeg
此时基本完成Jenkins环境安装与基础配置
构建iOS包
1 安装插件
-
选择系统管理
首页.png
-
进入插件管理
系统配置.png
-
添加所需插件
- Xcode integration
- GitLab Plugin
- Gitlab Hook Plugin
- Keychains and Provisioning Profiles Management

安装完成后重启Jenkins,命令行 brew services restart jenkins
或http://localhost:8080/restart
个人简单来直接在网址后面修改
2 创建项目

参数配置
1 git地址配置


2 项目shell脚本打包

cocoapods 脚本

脚本命令
#bin/bsah - l
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
cd ~/.jenkins/workspace/TestiOS/leimingBusiness
/usr/local/bin/pod install --verbose --no-repo-update
build工程

#!/bin/bash
#注意:脚本目录和WorkSpace目录在同一个目录
#工程名字(Target名字)
Project_Name="leimingBusiness"
Project_Path="$HOME/.jenkins/workspace/TestiOS/leimingBusiness/"
#workspace的名字
Workspace_Name="leimingBusiness"
#配置环境,Release或者Debug,默认release
Configuration="Debug"
EnterpriseExportOptionsPlist="$Project_Path"EnterpriseExportOptionsPlist.plist
EnterpriseExportOptionsPlist=${EnterpriseExportOptionsPlist}
echo " ---- clear --- "
xcodebuild -workspace ${Project_Path}"$Workspace_Name.xcworkspace" -scheme "${Project_Name}" -configuration ${Configuration} clean
echo " ---- archive ---- "
xcodebuild -workspace ${Project_Path}$Workspace_Name.xcworkspace -scheme $Project_Name -configuration $Configuration -archivePath ${Project_Path}build/$Project_Name-enterprise.xcarchive archive build
xcodebuild -exportArchive -archivePath ${Project_Path}build/$Project_Name-enterprise.xcarchive -exportOptionsPlist ${EnterpriseExportOptionsPlist} -exportPath $HOME/Desktop/MyWorkPlace/自动化打包IPAs/$Project_Name-enterprise
保存配置 基本上没什么出入打包成功
上传蒲公英操作
构建后操作
添加两个插件
Upload to pgyer with apiV1
Set build description
如果没有返回Jenkins插件管理下载
// 蒲公英插件
Upload to pgyer
// 描述插件
description setter

填写内容

HTML 文本标签
<a href="${appBuildURL}"><img src="${appQRCodeURL}" width="118" height="118"/></a>
保存后 设置Jenkins HTML格式默认Jenkins 回显方式text
进入 系统管理
-> 全局安全配置
-> 标记格式器

参考
Jenkins一:iOS自动打包完整实践
iOS持续集成—Jenkins(最新最全)
特此鸣谢
老友 旭总
RongCloud兵子
网友评论