Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fastlane on Android 介紹

Fastlane on Android 介紹

2017 Android Taipei 分享

Chien Shuo (Kros)

June 17, 2017
Tweet

More Decks by Chien Shuo (Kros)

Other Decks in Programming

Transcript

  1. Outline • What is fastlane • What to do •

    How to use • Details • Fastlane in real-world • 優缺點
  2. What is Fastlane • fastlane is the easiest way to

    automate beta deployments and releases for your iOS and Android apps. It handles all tedious tasks, like generating screenshots, dealing with code signing, and releasing your application. • ⼀一個⼯工具,讓你可以⽤用很簡單的⽅方式發佈 Apps, 處理理 iOS code signing 等問題。 • 最初是為了了 iOS 開發,後來來才新增 Android。
  3. What is Fastlane • ⽤用 Ruby 開發的, • Mac 可直接使⽤用。

    • Windows 的朋友要有 Ruby 環境才可以使⽤用。
  4. Why fastlane • 應該是 Why Continuous Delivery • 開發流程改變 •

    建立專案的第⼀一天,下班前就要能夠發佈給其他⼈人測試 • ⽇日後專案掛上 CI Server 也可以使⽤用 • fastlane 是⼀一個新選擇,local/server 皆可使⽤用
  5. What to do • Screenshots (⾃自動截圖、⾃自動上傳到 Google Play、處理理多國語系) • Beta

    Deployment (⾃自動發佈到 Google Play Beta, Fabric) • Release Deployment (⾃自動發佈到 Google Play)
  6. What to do • Screenshots (⾃自動截圖、⾃自動上傳到 Google Play) • Beta

    Deployment (⾃自動發佈到 Google Play Beta, Fabric) • Release Deployment (⾃自動發佈到 Google Play) • 今天只討論最常⽤用的兩兩個功能
  7. How to use • 執⾏行行三步驟: 1. 安裝 fastlane 2. 設定好

    fastlane 相關檔案參參數。 3. 在 Command Line 執⾏行行「⾃自⾏行行定義」的 fastlane 動作 (通常叫 lane)。
  8. Fastfile desc "Submit a new Beta Build to Crashlytics Beta"

    lane :beta do gradle(task: "assembleRelease") crashlytics end
  9. Fastfile desc "Submit a new Beta Build to Crashlytics Beta"

    lane :beta do gradle(task: "assembleRelease") crashlytics end • ⾃自定義⼀一個 lane
  10. Fastfile desc "Submit a new Beta Build to Crashlytics Beta"

    lane :beta do gradle(task: "assembleRelease") crashlytics end • 執⾏行行 gradle 的包版指令
  11. Fastfile desc "Submit a new Beta Build to Crashlytics Beta"

    lane :beta do gradle(task: "assembleRelease") crashlytics end • 上傳到 crashlytics (Fabric) beta
  12. Fastfile desc "Submit a new Beta Build to Crashlytics Beta"

    lane :beta do gradle(task: "assembleRelease") crashlytics end • 如何執⾏行行?
  13. Fastfile desc "Submit a new Beta Build to Crashlytics Beta"

    lane :beta do gradle(task: "assembleRelease") crashlytics end • 如何執⾏行行? fastlane beta
  14. desc "Submit a new Beta Build to Crashlytics Beta" lane

    :beta do ensure_git_status_clean changelog_from_git_commits start_git_flow_release clean_project test build_staging upload_to_fabric clean_project finish_git_flow_release post_to_slack end
  15. desc "Submit a new Beta Build to Crashlytics Beta" lane

    :beta do ensure_git_status_clean changelog_from_git_commits start_git_flow_release clean_project test build_staging upload_to_fabric clean_project finish_git_flow_release post_to_slack end Fastlane 提供的內建 lane
  16. desc "Submit a new Beta Build to Crashlytics Beta" lane

    :beta do ensure_git_status_clean changelog_from_git_commits start_git_flow_release clean_project test build_staging upload_to_fabric clean_project finish_git_flow_release post_to_slack end ⾃自⾏行行定義的 lane
  17. desc "Submit a new Beta Build to Crashlytics Beta" lane

    :beta do ensure_git_status_clean changelog_from_git_commits start_git_flow_release clean_project test build_staging upload_to_fabric clean_project finish_git_flow_release post_to_slack end
  18. desc "Submit a new Beta Build to Crashlytics Beta" lane

    :beta do ensure_git_status_clean changelog_from_git_commits start_git_flow_release clean_project test build_staging upload_to_fabric clean_project finish_git_flow_release post_to_slack end
  19. desc "Submit a new Beta Build to Crashlytics Beta" lane

    :beta do ensure_git_status_clean changelog_from_git_commits start_git_flow_release clean_project test build_staging upload_to_fabric clean_project finish_git_flow_release post_to_slack end
  20. Private Lane desc "Git Flow Release Start" private_lane :start_git_flow_release do

    Dir.chdir ".." do sh 'git flow release start "Release"' end end
  21. Private Lane desc "Git Flow Release Start" private_lane :start_git_flow_release do

    Dir.chdir ".." do sh 'git flow release start "Release"' end end
  22. Private Lane desc "Git Flow Release Start" private_lane :start_git_flow_release do

    Dir.chdir ".." do sh 'git flow release start "Release"' end end • lane 裡⾯面可以執⾏行行 shell script
  23. Read Config desc "Upload to fabric beta" private_lane :upload_to_fabric do

    crashlytics( api_token: ENV["CRASHLYTICS_API_TOKEN"], build_secret: ENV["CRASHLYTICS_BUILD_SECRET"] ) end
  24. Read Config desc "Upload to fabric beta" private_lane :upload_to_fabric do

    crashlytics( api_token: ENV["CRASHLYTICS_API_TOKEN"], build_secret: ENV["CRASHLYTICS_BUILD_SECRET"] ) end • 從 Appfile 讀出資料
  25. Error handling error do |lane, exception| slack( message: exception.message, success:

    false ) end • 包版失敗,通知開發⼈人員 • 除了了 slack 之外,也可以⾃自⾏行行定義要做什什麼事情
  26. Upload to Google Play • 使⽤用 Supply • 只能 upload

    and publish • But!最需要的是 upload and save draft • 看個⼈人需求
  27. 優缺點 • 優點 • 與 iOS 共⽤用同⼀一個⼯工具 • 可⽤用 Ruby

    做任何事情
 (rename, move file, increase build number) • 可以直接⽤用在 CI server 上 • Fabric 整合
  28. 優缺點 • 缺點 • 必須要有 ruby 環境 (Windows QQ) •

    額外學習 ruby 語⾔言 (團隊學習成本)