react-nativeexpoeasotaeas-update

How do I send an Expo EAS Update to a specific build or version of my app?


I create internal expo builds using:

npx eas-cli build --profile preview --platform ios
npx eas-cli build --profile preview --platform android

And, I send updates using:

npx eas-cli update --branch development --message \"$1\"

My eas.json looks like -

{
  "cli": {
    "version": ">= 2.1.0",
    "appVersionSource": "remote",
    "promptToConfigurePushNotifications": false
  },
  "build": {
    "development-simulator": {
      "developmentClient": true,
      "distribution": "internal",
      "channel": "development",
      "ios": {
        "simulator": true
      },
      "env": {
        "EXPO_PUBLIC_APP_ENV": "development"
      },
      "autoIncrement": true
    },
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "channel": "development",
      "env": {
        "EXPO_PUBLIC_APP_ENV": "development"
      },
      "autoIncrement": true
    },
    "preview": {
      "distribution": "internal",
      "channel": "development",
      "env": {
        "EXPO_PUBLIC_APP_ENV": "development"
      },
      "autoIncrement": true
    },
    "staging": {
      "distribution": "internal",
      "channel": "staging",
      "env": {
        "EXPO_PUBLIC_APP_ENV": "staging"
      },
      "autoIncrement": true
    },
    "production-internal": {
      "distribution": "internal",
      "channel": "production",
      "env": {
        "EXPO_PUBLIC_APP_ENV": "production"
      },
      "autoIncrement": true
    },
    "production": {
      "distribution": "store",
      "channel": "production",
      "env": {
        "EXPO_PUBLIC_APP_ENV": "production"
      },
      "autoIncrement": true
    }
  },
  "submit": {
    "production": {
      "ios": {
        "ascAppId": "6473792407",
        "appleTeamId": "P3BL9TXLG5"
      },
      "android": {
        "track": "internal",
        "releaseStatus": "draft",
        "serviceAccountKeyPath": "./android-deployment-service-account.json"
      }
    }
  }
}

As you can see, I auto-increment the build number (iOS)/ version code (Android).

How do I specifically send an update to Build number 29 when I have already created a new build with Build Number 30?

At present, I send updates to the following branches:

I am not sure if it's possible to target specific build or version to send updates. If the user is using version 1.0 of the app when version 2.0 is out, the new update might not be available for 1.0. It might break the app if the user gets the update. How can I avoid this scenario?


Solution

  • By default, expo-updates will target builds by Expo SDK version. It's kinda odd to be honest.

    To answer your question, you would want to configure runtimeVersion.policy to nativeVersion. It is documented here.

    You could set a specific version if you want but changing it to nativeVersion will let expo generate it for you. From the docs:

    The runtime version associated with this manifest. Set this to {"policy": "nativeVersion"} to generate it automatically.

    After setting it, your updates should now target that specific version+build automatically e.g. 1.0.1+69.

    Example app.json

    {
      "expo": {
        "runtimeVersion": {
          "policy": "nativeVersion"
        }
      }
    }