release channel and eas build

I ran the command eas build --profile demo with the following eas.json file

{
  "builds": {
    "android": {
      "release": {
        "workflow": "managed"
      },
      "demo": {
        "workflow": "managed",
        "releaseChannel": "demo"
      },
      "production": {
        "workflow": "managed",
        "releaseChannel": "production"
      }
    },
    "ios": {
      "release": {
        "workflow": "managed",
        "autoIncrement":"buildNumber"
      },
      "demo": {
        "workflow": "managed",
        "releaseChannel": "demo",
        "autoIncrement":"buildNumber"
      },
      "production": {
        "workflow": "managed",
        "releaseChannel": "production",
        "autoIncrement":"buildNumber"
      }
    }
  }
}

It seems however that I can not access the release channel in my app using Constants.manifest.releaseChannel (it used to work with expo build --release-channel demo)
How can I access the relase channel in the app? Should I use

Updates.releaseChannel

or create environment variables in the eas.json?

Thanks

Hi @gillesn!

When you build with EAS, we actually eject and automate the configuration of the bare app. This means that API’s like Constants.manifest might behave differently compared to the old expo build (classic). We are trying to minimize these changes, but sometimes this isn’t always possible.

The docs states that Updates.releaseChannel works in both managed and bare if you haven’t disabled expo-updates. Because this also works for bare, this should also work for your project :slight_smile:

You mentioned adding this manually through an environment variable. That should work too, but requires more manual steps. If you add this to the extra part of the manifest, you can retrieve it by using Updates.manifest.

Hope this helps!

Thanks, Updates.releaseChannel works fine!

When using my app in the expo go app after expo publish --release-channel demo-v1.2.5 (initial build was done with the command stated in the first post of this thread), it seems that Updates.releaseChannel is default. I created a function that fallbacks to Constants.manifest.releaseChannel in the aforemenntioned case. It seems that this value exists after a publish. Seems to work fine but not very straightforward… Would be useful to have a coherent way of dealing with release channels between eas and expo.

Thanks for pointing this out! That isn’t the intended behavior; Updates.releaseChannel is meant to be the source of truth in all cases. We’ve just pushed out a fix for this in expo-updates@0.5.5 which should make this field have the correct value in Expo Go.

1 Like