How are OTA updates made with managed projects on EAS?

How are OTA updates made with managed projects on EAS?

I just published an EAS build, but can not find information about how to do OTA updates.

I usually do daily OTA updates.

hello! see Over-the-air updates - Expo Documentation

2 Likes

Thank you Brent!

I looked through the documentation once again and couldn’t fint any information about how to publish updates.

Is it publishing the old way? Wouldn’t make much sense.

Is there an EAS command for OTA updates?

My eas.json looks like this:

{
  "builds": {
    "android": {
      "release": {
        "workflow": "managed"
      },
      "development": {
        "workflow": "managed",
        "buildType": "development-client",
        "distribution": "internal"
      }
    },
    "ios": {
      "release": {
        "workflow": "managed"
      },
      "development": {
        "workflow": "managed",
        "buildType": "development-client",
        "distribution": "internal"
      }
    }
  }
}

Should I add a release channel? I usually don’t use that. Or just have one.

How about versioning. Is that handled automatically?

Can’t find answers to all those questions in the docs.

Best
Andy

hi again!

indeed expo publish will do that trick. you should add a release channel as explained in the doc i linked to, and be sure to heed the warnings under the " Binary compatibility and other usage concerns" section

Thanks!

I just want to make sure I’m not crashing my app with an OTA update.

So if I get it right, the release chanel could conveniently be named:

"releaseChannel": Constants.manifest.version

I know I can’t add constants to the eas.json file, but …having it named in the eas.json file like this:

"releaseChannel": "1.0.38"

And then make OTA updates with:

expo publish --release chanel '1.0.38'

So the eas.json would look like this:

  "builds": {
    "android": {
      "release": {
        "workflow": "managed",
        "releaseChannel": "1.0.38"
      },
      "development": {
        "workflow": "managed",
        "releaseChannel": "1.0.38",
        "buildType": "development-client",
        "distribution": "internal"
      }
    },
    "ios": {
      "release": {
        "workflow": "managed"
        "releaseChannel": "1.0.38"
      },
      "development": {
        "workflow": "managed",
        "releaseChannel": "1.0.38",
        "buildType": "development-client",
        "distribution": "internal"
      }
    }
  }
}

?

Best
Andy

yup thats fine!

1 Like

Thanks @notbrent I’ll give it a try!

Best
Andy

Ok it didn’t work as well as I thought. Here from TestFlight:

Just did a EAS build and submit with the new release channel added in eas.json.

And this one pops up on app load. No expo publish made yet.

Should I do a expo publish before releasing or what is going on?

Best
Andy

Aparently I was running SDK 41. Upgraded and problem solved.

1 Like

All worked out. All good. Thank you for helping out.

A expo publish with the new release chanel has to be made before each build works or the expo-update will throw an exception.

It’s all good if you remember to test for it before submitting a new build. Exception thrown if menifest does not exist.

And thank you again!

Best
Andy

1 Like

@notbrent We are experiencing a similar issue. We’ve got some environment variables set in EAS.json, which are utilized when we build through EAS, but fail to get established when we try to push an OTA update with expo publish. For example:

{
  "build": {
    "staging": {
      "releaseChannel": "staging",
      "distribution": "internal",
      "env": {
        "ENVIRONMENT": "staging",
      }
    },
    "beta": {
      "releaseChannel": "beta",
      "distribution": "internal",
      "env": {
        "ENVIRONMENT": "beta",
      }
    },
     "production": {
      "releaseChannel": "default",
      "distribution": "internal",
      "env": {
        "ENVIRONMENT": "production",
      }
    }
  }
}

If we run $ expo publish --release-channel beta --target managed, we’d expect the env variable ENVIRONMENT would be set to beta. But it is not, leading us to believe that eas.json is ignored completely when running expo publish.

Is that true? Is there anyway to push an OTA update that takes the EAS.json env variables into account?

eas.json has no bearing on the results of expo publish – you would have to set the env vars for your publish command separately

And eas-cli has no OTA publish option? So if you have released a build made through EAS, what is the process for pushing out an OTA update?

Is it possible to access the release-channel in app.config.js? Then we could read the env variables set in eas.json and apply then manually? Or do we need to pass those environment specific variables as command line params to expo publish:

$ ENVIRONMEMT=beta expo publish

We’ve got a half dozen variables that change depending upon environment. Trying to determine the best way to manage setting those environment specific variables for OTA updates in a consistent manner.

there is no eas publish because eas update hasn’t been released yet :slight_smile: but even then, i’m not sure it will share env vars with build profiles. we’ll have to think about that…

why not just use some config files instead? then switch based on release channel at runtime? or switch based off of some environment variable like ENVIRONMENT like you specified above?

// config.js

// or just use `process.env.ENVIRONMENT` alongside something like `babel-plugin-transform-inline-environment-variables`

import * as Updates from 'expo-updates';

if (Updates.releaseChannel === 'production') {
  return { /* whatever */ };
} else if (Updates.releaseChannel === 'beta') {
  return { /* other */ };
} else {
  return { /* default */ };
}

that would work fine. or you can use ENVIRONMENT=beta expo publish and switch the above to read from that