1.新建新的任务

       mac下如何安装jenkins,请参考https://blog.csdn.net/liuyinghui523/article/details/81624302

2.添加字符参数

 这两个参数 主要是是发钉钉消息时候用的 

3 添加git或者svn地址,我是用的git 所以添加git地址

4 添加shell脚本和python脚本

  因为我这边用了cocoapods来集成工程,所以会有pod install命令 如果没有使用cocoapods 可以不加这个命令。

 make device-release  先保证在控制台是可以使用的。 如果不可以使用,有可能是svn或者git上的代码,工程配置没法直接打包,可以通过shell命令 去修改 配置文件或者证书配置。也可以在git上拉一个分支配置成可以直接打包的状态,有代码更新时候合并到打包分支。 

如何用脚本打包ipa 请参考 https://blog.csdn.net/liuyinghui523/article/details/81697470

pod install

make device-release

 

# coding: utf-8
import os
import json
import sys

#fix 中文乱码
reload(sys)
sys.setdefaultencoding('utf-8')

def uploadAPK():
	upload_cmd= "curl -F \"file=@“+”上传ipa的绝对路径”+”\” -F \"uKey=蒲公英中的ukey\” -F \"_api_key=蒲公英的apikey\” -F \"updateDescription=$UpdateDescription\" https://qiniu-storage.pgyer.com/apiv1/app/upload"
	print upload_cmd

	content = os.popen(upload_cmd).read()
	return content

def send_appQRCodeURL_to_dingtalk():
	upload_result = uploadAPK();
	data = json.loads(upload_result);
	# 配置发送dingtalk通知的请求参数
	body = {}
	link = {}
	link['title'] = “钉钉中 消息标题 (随意配置)“
	link['text'] = os.environ["UpdateDescription"]
	link['picUrl']= data['data']['appQRCodeURL']
	link['messageUrl’]=“蒲公英二维码所在链接”
	body['link'] = link
	body['msgtype'] = 'link'
	dataJson = json.dumps(body)
	# res = send_dingtalk_message(dataJson)
	# print(res.text)
	url = "https://oapi.dingtalk.com/robot/send?access_token="+os.environ["access_token"]
	send_cmd = "curl -H \'Content-Type: application/json\' -d \'"+dataJson+"\' "+url
	resp = os.popen(send_cmd).read()
	print resp
	


send_appQRCodeURL_to_dingtalk()

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐