Expo EAS: How to link eas update branch with build channel?

12.3k Views Asked by At

I have an expo (v 46.0.0) project with EAS with the following build config (eas.json).

{
  "cli": {
    "version": ">= 1.1.0"
  },
  "build": {
    "production": {
      "channel": "production",
      "env": {
        "APP_ENV": "production"
      },
      "credentialsSource": "local"
    },
    "preview": {
      "channel": "staging",
      "env": {
        "APP_ENV": "staging"
      },
      "credentialsSource": "local"
    },
    "development": {
      "distribution": "internal",
      "developmentClient": true,
      "ios": {
        "simulator": true
      }
    }
  },
  "submit": {
    "production": {}
  }
}

A preview build shows up in Expo as follows: Expo Preview Build

Now I used EAS Update to push some changes to the existing build with the following command: eas update --branch staging.

The update shows up in expo and it is also possible to use the Preview QR Code with Expo Go. However the changes do not populate to the preview version submitted to App Store and Play Store.

Do i need to do some additional steps to link the created update with the existing staging build?

3

There are 3 best solutions below

2
On

This is not possible if you are updating from the old release channel that used classic updates to the new eas update. I asked the question on the expo discord and got an answer from the staff.

0
On

This was also hard to understand for me but now I got it. Unfortunately the docs are so far not really clear.

EAS builds retrieve updates from the channel specified in eas.json. So normally for production builds you would have a channel named "production".

If you now want to run an EAS Update to distribute changes to clients you won't publish directly to a channel but instead you go a detour using branches. Because branches are linked to channels you can work with different branches (e.g. for different versions) and then you only need to change the branch-channel link to publish an update.

To change the linking between a branch and a channel you run:

eas channel:edit

In an simplified setup (like mine) you would have a git branch called production and also a channel with the same name. To publish an update you then just run:

eas update --branch production

or

eas update --auto

In the latter case EAS then sets your current git branch as the branch name, so you could check out the production branch and then run this command to publish the update.

0
On

After reading the docs, I think you have to have to think differently about branch and channel.

Channels are specified at build time and exist inside a build's native code.

and

Branches are an ordered list of updates, similar to a Git branch, which is an ordered list of commits.

With EAS Update, we can link any channel to any branch, allowing us to make different updates available to different builds.

So first you have to "publish" the update group to a branch and then you gotta link the channel to point to that branch.

I imagine it could look like

eas update --branch staging-1.0.1
eas channel:edit staging --branch staging-1.0.1

Please correct me if I'm wrong about anything here.

https://github.com/expo/eas-cli#eas-channeledit-name