bamlab/fastlane-plugin-cordova

CORDOVA_BUILD_NUMBER environment variable doesn't work

randomPoison opened this issue · 0 comments

If I run my lane that uses the cordova action with the CORDOVA_BUILD_NUMBER environment variable set, I get an error:

'build_number' value must be a Numeric! Found String instead.

This is the same error I get when I pass build_number into the cordova action from the Fastfile, e.g.:

cordova(
    platform: "android",
    build_number: 7,
)

works, but this:

cordova(
    platform: "android",
    build_number: "7",
)

gives me the same error message as when I use CORDOVA_BUILD_NUMBER.

As far as I know, they're no way to really pass a number via environment variables, they're always strings and you have to parse the number out if you want that. Therefore, one possible solution would be to parse the environment variable to a number before using it, and only fail if it's not a valid integer.

That said, I'm not sure restricting build_number to being a number is the right thing to do. On iOS, build_number corresponds to CFBundleVersion, which can be non-numeric values such as "1.2" or "1.2.3". I'd suggest instead allowing build_number to be either a number or a string, and simply pass the string directly through to the Cordova CLI.