jenkins自动打包ios、安卓

1、ios自动打包

  1.1 准备

    1.1.1 安装ios打包插件fastlane(注意macos版本,版本不一样安装方式不一样)

    1.1.2 下载开发者配置概要文件Provisioning Profiles

    

    

    1.1.3 jenkins安装(安装建议使用war包,避免出现权限问题)

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

     1.1.4 导出provisioning profiles 文件至桌面,并更名为login.keychain

  

  

  1.2、jenkins安装需要的插件

    hg安装配置(这里安装hg的插件,但是好像用不了,后来用的自己配置的,在系统设置>全局工具管理)

    keychains and provisioning profiles management管理插件安装

  

  1.3、配置插件

    系统设置>keychains and provisioning profiles management

    

  上传放在桌面的2个文件:login.keychain、**.mobileprovision

  在keychains中输入mac的开机密码,并在indentities中输入开发者信息,可以在钥匙串中找到证书查看复制

    

  1.4、配置jenkins

   

   

  

  执行shell并上传至蒲公英(若报错,fastlane的path需配置,在shell中echo $PATH,将环境变量配置到jenkins中:系统管理>系统设置>全局变量中设置)

cd 项目目录下
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8


IPANAME="xxx_ios"

 xcodebuild clean -configuration Release -alltargets

  xcodebuild archive -workspace ./MeidianInVehicle.xcworkspace -scheme MeidianInVehicle -configuration Release -archivePath ./wangwang.xcarchive

  xcodebuild -exportArchive -archivePath ./wangwang.xcarchive -exportPath ~/Desktop/project.ipa -exportOptionsPlist ~/Desktop/a.plist


##最近这个方法有点问题 ##fastlane gym --export_method development --output_name ${IPANAME} curl -F "file=@${IPANAME}.ipa" -F "uKey=ukeyname" -F "_api_key=apikey" https://qiniu-storage.pgyer.com/apiv1/app/upload

 关于a.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>teamID</key>
			<string>XXXX</string>
		<key>method</key>
			<string>development</string>
		<key>compileBitcode</key>
	<false/>
	</dict>
</plist>

  

    

原文地址:https://www.cnblogs.com/ceshixuexi/p/9198164.html