我們的工程做了自動打包處理,但是每次打完ipa后只是放置於一個共享盤或者本地,為了方便測試,每次都要手動上傳上傳fir或者蒲公英,比較麻煩。所以研究了一下怎么能在打完包后直接腳本上傳到上傳fir或者蒲公英,這樣就能直接發二維碼或者鏈接給測試人員。
一.上傳到fir.im
1.安裝fir-cli
要上傳fir.im需要先安裝fir-cli工具,推薦使用Homebrew
gem install fir-cli
2.獲取fir.im的token值
在“我的應用”頁面右上角,點擊賬號圖標,選擇“API Token”,就會出現你的fir賬號的token值了
3.發布ipa
cd到要上傳的.ipa包目錄下,執行命令即可
fir publish .ipa包路徑
#補充命令 -s, [--short=SHORT] # Set custom short link(設置后邊的短鏈接) -c, [--changelog=CHANGELOG] # Set changelog(填寫更新日志,支持字符串或者文本文件) -Q, [--qrcode], [--no-qrcode] # Generate qrcode(在ipa/apk同級目錄生成下載二維碼) -m, [--mappingfile=MAPPINGFILE] # App mapping file -P, [--proj=PROJ] # Project id in BugHD.com if upload app mapping file [--open], [--no-open] # true/false if open for everyone [--password=PASSWORD] # Set password for app -T, [--token=TOKEN] # User's API Token at fir.im -L, [--logfile=LOGFILE] # Path to writable logfile -V, [--verbose], [--no-verbose] # Show verbose(展示進度詳情) # Default: true -q, [--quiet], [--no-quiet] # Silence commands -h, [--help], [--no-help] # Show this help message and quit
二、上傳蒲公英
蒲公英文檔里面有詳細說明:http://www.pgyer.com/doc/view/upload_one_command
curl -F "file=@{$filePath}" \ -F "uKey={$uKey}" \ -F "_api_key={$apiKey}" \ http://www.pgyer.com/apiv1/app/upload 其中: {$filePath}是應用安裝包文件的路徑 {$uKey}是開發者的用戶 Key,在應用管理-API中查看 {$apiKey}是開發者的 API Key,在應用管理-API中查看