LoginSignup
0

More than 1 year has passed since last update.

[iOS] Firebase + fastlaneでdSYMアップロード

始めに

最近、dSYMのアップロードがFirebaseのコンソールからはできなくなっており、コマンドラインからしか受け付けなくなっていた。
なので、AppStoreからダウンロード・Firebaseにアップロードをfastlaneで自動化した。

目次

  1. 前提
  2. fastlaneをインストールと初期化
  3. Appfileをセットアップ
  4. Fastfileを編集
  5. 実行してみる

前提

fastlaneのインストールと初期化

公式

Homebrewインストールがおすすめです。

$ brew install fastlane

その後、プロジェクトの場所まで移動し、以下のコマンドを実行する

$ fastlane init

fastlaneの初期化方法を選択する

1. 📸  Automate screenshots
2. 👩‍✈️  Automate beta distribution to TestFlight
3. 🚀  Automate App Store distribution
4. 🛠  Manual setup - manually setup your project to automate your tasks

自分の場合は、dSYMアップロードだけだったので、「4」を選択。
以下の2つのファイルが生成される。

fastlane/Appfile
fastlane/Fastfile

Appfileをセットアップ

Appfileでプロジェクトやアカウントの設定を行う。

Appfile
app_identifier("[bundle identifier]") # アプリのバンドルID
apple_id("sample@example.com") # Apple ID
team_id("[team ID]")
itc_team_id("[appstoreconnect ID]")

team_id

Developer Portalから取得

itc_team_id

AppStoreConnectにログイン後、以下のURLからJSONを確認する。
https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/user/detail
この中のcontentProviderIdの値。
取得方法はこちらを参照した。

Fastfileを編集

最小限の実装は以下のとおり

default_platform(:ios)

platform :ios do
  desc "Description of what the lane does"
  lane :dsym do
    download_dsyms(version: 'latest')
    upload_symbols_to_crashlytics(gsp_path: "[path to GoogleService-Info.plist]")
    clean_build_artifacts
  end
end

gsp_path

GoogleService-Info.plistへのパス

実行してみる

$ fastlane dsym

AppStoreConnectにログインするので、最初はパスワードを聞かれる。セッションが保存されるので、次回からはパスワードは聞かれない。

参考

https://qiita.com/giiiita/items/333af46cade134883c83
https://docs.fastlane.tools/getting-started/ios/setup/
https://docs.fastlane.tools/advanced/Appfile/
https://docs.fastlane.tools/actions/download_dsyms/
https://docs.fastlane.tools/actions/upload_symbols_to_crashlytics/
https://github.com/fastlane/fastlane/issues/4301#issuecomment-253461017
https://firebase.google.com/docs/crashlytics/get-started?hl=ja

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0