Incrementing and identifying version and build


#1

Hi all. I’m looking for advice please.

My app was recently added to the iOS App Store as version 1.0.0.

I then made a small text correction and ran expo publish to deploy the change, which worked perfectly.

I’m wondering what the recommended best practice is in this regard. Should I update my app.json to show an app version of 1.0.1? If so, I don’t want to submit a formal new version through App Store connect. But if one day I make a major change, should I? Or should I just always use expo publish and not touch the App Store connect as long as I don’t make a change that requires a new binary?

Lastly, I use the following to show the version number on my app’s support page:

let app = require('../../../app.json');
<Text style={styles.buttonSubText}>
   {translate('versionNumber', localeName) + app.expo.version}
</Text>

If I decide not to increment my version number each time I publish a small change, is there a way I can retrieve and display a build identifier from expo (alongside the version) so that I can be sure a user who contacts support is using the latest publish?

Thanks in advance.


#2

Whether this is the “best” practice is in the eyes of the beholder, but what I’ve ended up doing is keeping a separate version number just for my JavaScript bundle. I have a simple file called build.json that has a single property:

{
  "jsBuildNumber": 1
}

Then, I have a node.js script that wraps expo publish, incrementing the build number just before publishing:

const shell = require('shelljs');
const jsonfile = require('jsonfile');
const file = 'build.json';

const data = jsonfile.readFileSync(file);
data.jsBuildNumber = data.jsBuildNumber + 1;

jsonfile.writeFileSync(file, data, { spaces: 2, EOL: '\r\n' });
shell.exec('expo publish');

Then I include that build.json file in my app and display that number along with the version number and build number in our app settings screen, like “1.0.2 / 16 / 1” (version/ build/ JS build).

I think something like this works best in terms of support. I want my version numbers to match what’s on the App Store so nobody is wondering why the app says one thing and the store says another, and, even if they don’t fully understand the OTA updates, I’d like our support folks to be able to communicate a version number to me that tells me if we’re dealing with an OTA update or what was originally published to the store.

One other thing I like to do with this is reset the JS build number when I publish another store version. So then my full three-part version number indicates on its own if its the first store build of that version or a later JS update.


#3

Thanks for the thorough reply, very much appreciated.

Where does the middle build value (16) come from? Does it not increment every time you publish a new build?


#4

That’s the standalone binary’s build number from app.json, e.g., expo.ios.buildNumber or expo.android.versionCode. Publishing a new JS bundle does’t mean I’m doing a new standalone app, or vice versa. So, I only increment the binary build number when I’m building a new standalone version, I only increment the JS build number when I’m running expo publish, and I only change expo.version when… I want to, I guess :slight_smile: (this number is mostly about what shows up in the App Store, IMO).

In short, the full version I report in the app’s settings screen is:

Expo.Constants.manifest.version +
(Expo.Constants.manifest.ios.buildNumber OR Expo.Constants.manifest.android.versionCode) +
my custom JS build number that I increment every time I publish.


#5

Makes sense. Could I do this manually by adding (and remembering to increment each time I publish) a jsBuildNumber within the expo object of app.json, or would that cause problems?


#6

I ended up adding a new object property below “expo” in the app.json object into which I added my build number (which is just the date set manually in yyyy.mm.dd.mm.ss form just before publishing). I appreciate your automated solution and will perhaps use it in the future. Thanks again.


closed #7

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.