byCedric / semantic-release-expo

An Expo implementation for semantic release, so you don't have to bother.
MIT License
91 stars 11 forks source link

[Android]: "recommended" strategy defaults versionCode to 0 #190

Open kaminskypavel opened 4 years ago

kaminskypavel commented 4 years ago

@byCedric , great work with this plugin!

.releaserc

  "prepare": [
    {
      "path": "semantic-release-expo",
      "manifests": ["app.json"]
    },

log

[5:10:30 PM] [semantic-release] [semantic-release-expo] › ℹ Expo manifest version changed (1.0.3 => 1.1.0) in app.json [5:10:30 PM] [semantic-release] [semantic-release-expo] › ℹ Expo manifest android version changed (1 => 0) in app.json [5:10:30 PM] [semantic-release] [semantic-release-expo] › ℹ Expo manifest ios version changed (1.0.3 => 1.1.0) in app.json

as you can see while app.json version and ios version are getting the right value, android is getting version code 0

kaminskypavel commented 4 years ago

a follow up :

changing the strategy to

  "versions": {
    "version": "${next.raw}",
    "android": "${increment}",    <----------- 
    "ios": "${next.raw}"
  }
[10:23:46 AM] [semantic-release] › ℹ  Start step "prepare" of plugin "semantic-release-expo"
[10:23:46 AM] [semantic-release] [semantic-release-expo] › ℹ  Expo manifest version changed (1.1.0 => 1.1.1) in app.json
[10:23:46 AM] [semantic-release] [semantic-release-expo] › ℹ  Expo manifest android version changed (0 => 1) in app.json <------------
[10:23:46 AM] [semantic-release] [semantic-release-expo] › ℹ  Expo manifest ios version changed (1.1.0 => 1.1.1) in app.json
faceleg commented 4 years ago

I've encountered this issue on two projects (one new, one > 1 year old), confirming that @kaminskypavel's solution has resolved the issue for me.

timmyers commented 4 years ago

Happening to me as well.

I believe this is occuring due to the logic of this function https://github.com/byCedric/semantic-release-expo/blob/develop/src/version.ts#L21.

Somewhat recently, the expo sdk version was removed from app.json (upgrading sdk versions with the expo CLI removed it automatically). If this value is blank, the function will return 0.

I just confirmed that adding back in e.g. "sdkVersion": "38.0.0", makes this work as expected again. Since the value is now optional in app.json, it would be best to switch to the same strategy used by expo: https://forums.expo.io/t/expo-36-upgrade-from-cli-removes-sdkversion-from-app-json-why/34634/3.