在使用iOS 自動(dòng)化打包成功之后酒贬,上傳到發(fā)布平臺(tái)之后,郵件通知測試人員翠霍,這樣就不用在另外通知測試人員了锭吨。一切以自動(dòng)化(偷懶)為目標(biāo)的,嘿嘿寒匙。零如。。锄弱。
自動(dòng)化打包腳本下載地址:
https://github.com/fenglingdeyi/archiveshell
在上傳到平臺(tái)下面可以添加一下腳本語言發(fā)送郵件考蕾。以iOS 自動(dòng)打包之后上傳到發(fā)布平臺(tái)后發(fā)送郵件為例:
在shell腳本中執(zhí)行發(fā)送郵件的腳本sendEmail腳本如下:
curl -F "file=@${exportIpaPath}/${scheme_name}.ipa" -F "uKey=${MY_PGY_UK}" -F "_api_key=${MY_PGY_API_K}" https://qiniu-storage.xxxx.com/xxxx/app/xxxx
echo "\n\n"
echo "已運(yùn)行完畢>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
這部分是上傳平臺(tái)成功之后
《《《《《《《《《《《《《《《《《《《《《《《
成功之后,在shell腳本中添加這些代碼会宪。這是以iOS 自動(dòng)打包為IPA包上傳到發(fā)布平臺(tái)為例:
//得到IPA中Info.plist的路徑
appInfoPlistPath="`pwd`/HuoHuo/Info.plist"
//獲取版本號(hào)
bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" ${appInfoPlistPath})
bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" ${appInfoPlistPath})
echo '///-------------'
echo '/// 郵件發(fā)送中肖卧。。掸鹅。塞帐。。巍沙。葵姥。。 '
echo '///-------------'
#上傳到蒲公英成功之后 發(fā)送郵件
python sendEmail.py "測試版本 iOS ${bundleShortVersion}(${bundleVersion})上傳成功" "趕緊下載體驗(yàn)吧!https://www.xxx.com/xxxxx"
exit 0
下面是發(fā)送郵件sendEmail.py的核心代碼:
#!/usr/bin/env python3
# coding=utf-8
# sendEmail title content
import sys
import smtplib
from email.mime.text import MIMEText
from email.header import Header
//配置發(fā)送的郵箱
sender = '2797xxxxx@qq.com;'
//配置接收的郵箱
receiver = 'dongkai_qiang@163.com;'
//SMTP郵件服務(wù)器 以QQ郵箱配置的
smtpserver = 'smtp.qq.com'
#smtpserver = 'smtp.exmail.qq.com'
//配置SMTP開啟服務(wù)的賬號(hào)和授權(quán)密碼密碼
username = '2797xxxxx@qq.com'
password = 'yelqxxxxxxx'
//這是配置發(fā)送郵件的python代碼
def send_mail(title, content):
//title代表標(biāo)題 content代表郵件內(nèi)容
try:
msg = MIMEText(content,'plain','utf-8')
if not isinstance(title,unicode):
title = unicode(title, 'utf-8')
msg['Subject'] = title
msg['From'] = sender
msg['To'] = receiver
msg["Accept-Language"]="zh-CN"
msg["Accept-Charset"]="ISO-8859-1,utf-8"
smtp = smtplib.SMTP_SSL(smtpserver,465)
smtp.login(username, password)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.quit()
return True
except Exception, e:
print str(e)
return False
if send_mail(sys.argv[1], sys.argv[2]):
print "done!"
else:
print "failed!"
配置SMTP郵件服務(wù)器流程:(QQ郵箱為例)
第一步:登錄自己的一個(gè)QQ郵箱句携,設(shè)置SMTP郵件服務(wù)器榔幸。
第二步:登錄之后
然后往下拉,找到下面
點(diǎn)擊開啟矮嫉,出現(xiàn)下面
然后使用手機(jī)發(fā)送短信牡辽,發(fā)送完之后,出現(xiàn)下面
密碼框中的授權(quán)碼就是
//配置SMTP開啟服務(wù)的賬號(hào)
username = 'xxxxxxx@qq.com'
授權(quán)碼
password = 'xxxxxxxxx'
這樣就配好了敞临。
然后以xcode自動(dòng)打包上傳到蒲公英發(fā)布平臺(tái)為例
把自動(dòng)打包腳本和發(fā)送郵件腳本放到工程目錄下:
iOS 自動(dòng)打包參考地址:
使用Xcode9一鍵打包上傳到App Store或者fir和蒲公英
http://blog.csdn.net/dkq972958298/article/details/78215633
執(zhí)行腳本shell.sh态辛,如果上傳到蒲公英之后,會(huì)自動(dòng)發(fā)郵件提醒挺尿。
這是腳本已經(jīng)一致完畢奏黑,打包成功之后上傳到蒲公英發(fā)布平臺(tái)炊邦,發(fā)送郵件成功。
在蒲公英里面最新版本如下圖:
測試人員收到郵件內(nèi)容:
點(diǎn)擊鏈接:
然后就可以點(diǎn)擊安裝啦熟史,有木有很方便啊 馁害!
發(fā)送郵件腳本地址:https://github.com/fenglingdeyi/sendEmail
參考鏈接:
iOS 自動(dòng)打包上傳鏈接地址:http://blog.csdn.net/dkq972958298/article/details/78215633