Fastlane自動(dòng)化打包---打包上傳蒲公英篇

Fastlane自動(dòng)化打包---安裝篇
Fastlane自動(dòng)化打包---配置篇

參考文檔:

3. 打包上傳蒲公英

3.1 配置Fastlane插件

補(bǔ)充:我是在上傳到蒲公英的時(shí)候報(bào)錯(cuò)了才知道需要安裝插件秕重,所以退回來(lái)配置了幾個(gè)插件
安裝過(guò)插件之后Gemfile文件中就會(huì)生成插件的路徑在fastlane文件下生成了一個(gè)Pluginfile文件

Gemfile文件

Pluginfile文件

這里我安裝了三個(gè)插件檀训。也可參考Fastlane官網(wǎng)插件安裝

3.1.1 安裝fir插件
$ cd 項(xiàng)目目錄
$ bundle exec fastlane add_plugin fir

參考安裝fir插件圖文教程中分析了遇到的錯(cuò)誤肄满,我沒(méi)有遇到直接就過(guò)了如下

$ cd 項(xiàng)目目錄
$ bundle exec fastlane add_plugin fir
[?] ?? 
[13:50:25]: It seems like you wanted to load some plugins, however they couldn't be loaded
[13:50:25]: Please follow the troubleshooting guide: https://docs.fastlane.tools/plugins/plugins-troubleshooting/
[13:50:30]: Plugin 'fastlane-plugin-fir' was added to './fastlane/Pluginfile'
[13:50:30]: It looks like fastlane plugins are not yet set up for this project.
[13:50:30]: fastlane will modify your existing Gemfile at path 'Gemfile路徑'
[13:50:30]: This change is necessary for fastlane plugins to work
[13:50:30]: Should fastlane modify the Gemfile at path
'Gemfile路徑' for you? (y/n)
y
[13:50:46]: Successfully modified 'Gemfile路徑'
[13:50:46]: Make sure to commit your Gemfile, Gemfile.lock and Pluginfile to version control
Installing plugin dependencies...


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Successfully installed plugins
3.1.2 安裝蒲公英pgyer插件
$ cd 項(xiàng)目目錄
$ bundle exec fastlane add_plugin pgyer
$ bundle exec fastlane add_plugin pgyer
[?] ?? 
+-----------------------+---------+--------+
|               Used plugins               |
+-----------------------+---------+--------+
| Plugin                | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.1   | pgyer  |
| fastlane-plugin-fir   | 0.3.0   | fir    |
+-----------------------+---------+--------+

[13:56:19]: Make sure to commit your Gemfile, Gemfile.lock and Pluginfile to version control
Installing plugin dependencies...
Successfully installed plugins
3.1.3 安裝versioning插件
$ cd 項(xiàng)目目錄
$ bundle exec fastlane add_plugin versioning
$ bundle exec fastlane add_plugin versioning
[?] ?? 
+-----------------------+---------+--------+
|               Used plugins               |
+-----------------------+---------+--------+
| Plugin                | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.1   | pgyer  |
| fastlane-plugin-fir   | 0.3.0   | fir    |
+-----------------------+---------+--------+

[13:56:34]: Plugin 'fastlane-plugin-versioning' was added to './fastlane/Pluginfile'
[13:56:34]: Make sure to commit your Gemfile, Gemfile.lock and Pluginfile to version control
Installing plugin dependencies...


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Successfully installed plugins
3.2 增加上傳到蒲公英的lane
  • Fastfile文件中新增lane
  • 以下是官方給的 api_key 和 user_key 都是蒲公英的配置參考蒲公英
lane :beta do
  build_app(export_method: "ad-hoc")
  pgyer(api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e")
end
  • 我貼出我自己找的,修改的行疏,其中有一些坑
desc "打包上傳到蒲公英"
    lane :do_pgyer do #|options|
        # 打包命令 gym和build_app都是build_ios_app的別名
        # 自動(dòng)代碼簽名
        #enable_automatic_code_signing
        gym(
         clean:true, #打包前clean項(xiàng)目
         export_method: "ad-hoc", #導(dǎo)出方式
         scheme:"FastlaneDev", #scheme
         # configuration: "Debug",#環(huán)境
         output_directory: "./Ipa",#ipa的存放目錄
         output_name:  get_version_number_from_plist() + "_" + Time.new.strftime("%Y-%m-%d %H-%M-%S")  #輸出ipa的文件名為當(dāng)前的build號(hào)和創(chuàng)建的時(shí)間
          
         export_options: {
                #手動(dòng)配置代碼簽名
                provisioningProfiles: { 
                    "項(xiàng)目的Bundle identifier": "證書(shū)名稱(chēng)",
                        }
                }
        )
        # 上傳命令
        pgyer(
            api_key: "7f15xxxxxxxxxxxxxxxxxx141", user_key: "4a5bcxxxxxxxxxxxxxxx3a9e"
        )
    end
3.3 上傳包到蒲公英
[15:07:48]: Successfully exported and compressed dSYM file
[15:07:48]: Successfully exported and signed the ipa file:
[15:07:48]: `包的存放路徑+`_2018-07-24 15:05:40.ipa
[15:07:48]: -------------------
[15:07:48]: --- Step: pgyer ---
[15:07:48]: -------------------
[15:07:48]: The pgyer plugin is working.
[15:07:48]: build_file:  `包的存放路徑+`_2018-07-24 15:05:40.ipa
[15:07:48]: Start upload `包的存放路徑+`_2018-07-24 15:05:40.ipa to pgyer...
[15:07:59]: Upload success. Visit this URL to see: https://www.pgyer.com/Zz1I

+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 2    | get_build_number | 0           |
| 3    | gym              | 128         |
| 4    | pgyer            | 10          |
+------+------------------+-------------+

[15:07:59]: fastlane.tools finished successfully ??
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市兑牡,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌寒波,老刑警劉巖乘盼,帶你破解...
    沈念sama閱讀 218,755評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件升熊,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡绸栅,警方通過(guò)查閱死者的電腦和手機(jī)级野,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén),熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)粹胯,“玉大人蓖柔,你說(shuō)我怎么就攤上這事》缇溃” “怎么了况鸣?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,138評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)竹观。 經(jīng)常有香客問(wèn)我镐捧,道長(zhǎng),這世上最難降的妖魔是什么臭增? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,791評(píng)論 1 295
  • 正文 為了忘掉前任懂酱,我火速辦了婚禮,結(jié)果婚禮上誊抛,老公的妹妹穿的比我還像新娘列牺。我一直安慰自己,他們只是感情好拗窃,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,794評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布瞎领。 她就那樣靜靜地躺著,像睡著了一般随夸。 火紅的嫁衣襯著肌膚如雪九默。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 51,631評(píng)論 1 305
  • 那天逃魄,我揣著相機(jī)與錄音荤西,去河邊找鬼。 笑死伍俘,一個(gè)胖子當(dāng)著我的面吹牛邪锌,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播癌瘾,決...
    沈念sama閱讀 40,362評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼觅丰,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了妨退?” 一聲冷哼從身側(cè)響起妇萄,我...
    開(kāi)封第一講書(shū)人閱讀 39,264評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤蜕企,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后冠句,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體轻掩,經(jīng)...
    沈念sama閱讀 45,724評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評(píng)論 3 336
  • 正文 我和宋清朗相戀三年懦底,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了唇牧。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,040評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡聚唐,死狀恐怖丐重,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情杆查,我是刑警寧澤扮惦,帶...
    沈念sama閱讀 35,742評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站亲桦,受9級(jí)特大地震影響崖蜜,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜烙肺,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,364評(píng)論 3 330
  • 文/蒙蒙 一纳猪、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧桃笙,春花似錦氏堤、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,944評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至星著,卻和暖如春购笆,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背虚循。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,060評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工同欠, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人横缔。 一個(gè)月前我還...
    沈念sama閱讀 48,247評(píng)論 3 371
  • 正文 我出身青樓铺遂,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親茎刚。 傳聞我的和親對(duì)象是個(gè)殘疾皇子襟锐,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,979評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容