Commit 18b3f263d8b5fd3517ed0817cbfa3f13f16d01f1

Authored by iOS-Xiaowen
1 parent 4e912cf5

no message

Showing 1 changed file with 33 additions and 5 deletions
auto_upload.py
@@ -29,6 +29,9 @@ APPLE_API_ISSUER = '69a6de70-6693-47e3-e053-5b8c7c11a4d1' @@ -29,6 +29,9 @@ APPLE_API_ISSUER = '69a6de70-6693-47e3-e053-5b8c7c11a4d1'
29 PGYER_USER_KEY = '6a9a62d9659d6821721cf34169358ddc' 29 PGYER_USER_KEY = '6a9a62d9659d6821721cf34169358ddc'
30 PGYER_API_KEY = '102d5b282e595feb713f24ecf1763313' 30 PGYER_API_KEY = '102d5b282e595feb713f24ecf1763313'
31 31
  32 +# fir
  33 +FIR_TOKEN = '11d64fd25fb24f3e4c5da67a39541ee8'
  34 +
32 # 发送邮件 35 # 发送邮件
33 from_address = '153993236@qq.com' # 发送人的地址 36 from_address = '153993236@qq.com' # 发送人的地址
34 password = 'hqotqsilkkylcbac' # 邮箱密码换成他提供的16位授权码 37 password = 'hqotqsilkkylcbac' # 邮箱密码换成他提供的16位授权码
@@ -145,6 +148,27 @@ class AutoUpload(object): @@ -145,6 +148,27 @@ class AutoUpload(object):
145 self.send_email() 148 self.send_email()
146 else: 149 else:
147 print("=======上传蒲公英失败,用时:%.2f秒=======" % (end - start)) 150 print("=======上传蒲公英失败,用时:%.2f秒=======" % (end - start))
  151 + elif self.number == 3:
  152 + print("\n\n===========开始上传Fir操作===========")
  153 + loginCmd = 'fir login -T %s' % (FIR_TOKEN)
  154 + process = subprocess.Popen(loginCmd, shell=True)
  155 + process.wait()
  156 + loginReturnCode = process.returncode
  157 + if loginReturnCode != 0:
  158 + print("=======上传登录Fir失败")
  159 + else:
  160 + print("=======上传登录Fir成功")
  161 + start = time.time()
  162 + publishCmd = 'fir publish %s -c %s'%(ipa_path, upload_version)
  163 + process = subprocess.Popen(publishCmd, shell=True)
  164 + process.wait()
  165 + publishReturnCode = process.returncode
  166 + end = time.time()
  167 + if publishReturnCode != 0:
  168 + print("=======上传Fir失败,用时:%.2f秒=======" % (end - start))
  169 + else:
  170 + print("=======上传Fir成功,用时:%.2f秒=======" % (end - start))
  171 + self.send_email()
148 172
149 else: 173 else:
150 print("\n\n===========没有找到对应的ipa===========") 174 print("\n\n===========没有找到对应的ipa===========")
@@ -195,6 +219,8 @@ def command_line(): @@ -195,6 +219,8 @@ def command_line():
195 return 1 219 return 1
196 elif combined['store'] == 'pgyer': 220 elif combined['store'] == 'pgyer':
197 return 2 221 return 2
  222 + elif combined['store'] == 'fir':
  223 + return 3
198 else: 224 else:
199 return 0 225 return 0
200 226
@@ -204,14 +230,16 @@ if __name__ == '__main__': @@ -204,14 +230,16 @@ if __name__ == '__main__':
204 # 1、先用命令行方式,获取number 230 # 1、先用命令行方式,获取number
205 # python3 auto_upload.py 或者 python3 auto_upload.py -s app-store 或者 python3 auto_upload.py --store app-store 231 # python3 auto_upload.py 或者 python3 auto_upload.py -s app-store 或者 python3 auto_upload.py --store app-store
206 # python3 auto_upload.py -s pgyer 或者 python3 auto_upload.py --store pgyer 232 # python3 auto_upload.py -s pgyer 或者 python3 auto_upload.py --store pgyer
  233 + # python3 auto_upload.py -s fir 或者 python3 auto_upload.py --store fir
  234 +
207 number = command_line() 235 number = command_line()
208 - if (number != 1 and number != 2): 236 + if (number != 1 and number != 2 and number != 3):
209 237
210 # 2、再用手动输入方式,获取number 238 # 2、再用手动输入方式,获取number
211 - number = int(input("\n\nPlace enter the number you want to upload ? [ 1:app-store 2:蒲公英 ] "))  
212 - while (number != 1 and number != 2):  
213 - print("Error! Should enter 1 or 2")  
214 - number = int(input("\n\nPlace enter the number you want to upload ? [ 1:app-store 2:蒲公英 ] ")) 239 + number = int(input("\n\nPlace enter the number you want to upload ? [ 1:app-store 2:蒲公英 3:fir ] "))
  240 + while (number != 1 and number != 2 and number != 3):
  241 + print("Error! Should enter 1 or 2 or 3")
  242 + number = int(input("\n\nPlace enter the number you want to upload ? [ 1:app-store 2:蒲公英 3:fir ] "))
215 243
216 # 3、根据number创建上传对象 244 # 3、根据number创建上传对象
217 upload = AutoUpload(number) 245 upload = AutoUpload(number)