Skip to content

Instantly share code, notes, and snippets.

@alternacrow
Last active July 11, 2023 12:49
Show Gist options
  • Save alternacrow/0ba98ef43bab6cd298fdbd75bb9aa9a1 to your computer and use it in GitHub Desktop.
Save alternacrow/0ba98ef43bab6cd298fdbd75bb9aa9a1 to your computer and use it in GitHub Desktop.
EAS Update

EAS Update

EAS Update の仕組み

Concepts / How EAS Update works
https://docs.expo.dev/eas-update/how-it-works/

Channel と Branch の概念が存在する。
ビルドされたアプリケーションは eas.jsonで設定された Channel を持つ。
Channel には Branch を紐付けることができ、Branch を更新することで Channel に紐付けられたアプリケーションを更新することができる。

更新可能な差分は JavaScript Bundle と Asset であり、iOS/Android のネイティブコードの変更などを行う場合はアプリケーションの再ビルドが必要となる。

ビルド時の Channel 作成について

eas build を実行すると、eas.json 上で設定されている 指定のプロファイルの Channel が自動的に作成される。
例えば、下記のeas.jsonがある場合、eas build --profile stagingでビルドを行うとversion-staging-1.0.0の名前で Channel が作成される。

{
  "build": {
    "staging": {
      "channel": "version-staging-1.0.0"
    }
  }
}

既に同名の Channel が存在する場合は、既存の Channel が新しいビルドに紐づく。

EAS Update の Branch/Channel 指定について

EAS Update は Branch もしくは Channel を指定して行う。

Branch を指定する場合

eas update --branch $CHANNEL_NAME

Branch が存在しなければ作成され、自動的に同名の Channel と紐付けされる。
Branch と Channel のどちらも存在しない場合は、両方が作成され、お互いに紐付けられる。

Channel を指定した場合

eas update --channel $CHANNEL_NAME

紐づく Branch を自動的に対象とする。
Branch と Channel のどちらも存在しない場合は、両方が作成され、お互いに紐付けられる。

例外

Channel は存在するが、Branch が紐づいていない状態で Channel 指定の EAS Update を行おうとすると、以下のエラーが発生する。

Channel has no branches associated with it. Run 'eas channel:edit' to map a branch
    Error: update command failed.

また、両方を指定することは出来ず、指定すると下記のエラーが発生する。

Cannot specify both --channel and --branch. Specify either --channel, --branch, or --auto.
    Error: update command failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment