Use env var to determine bundle version code and use it if it is defined

parent 81d50816
......@@ -10,6 +10,7 @@ static class BuildCommand
private const string KEY_ALIAS_NAME = "KEY_ALIAS_NAME";
private const string KEYSTORE = "keystore.keystore";
private const string BUILD_OPTIONS_ENV_VAR = "BuildOptions";
private const string ANDROID_BUNDLE_VERSION_CODE = "BUNDLE_VERSION_CODE";
static string GetArgument(string name)
{
......@@ -147,6 +148,7 @@ static class BuildCommand
var buildTarget = GetBuildTarget();
if (buildTarget == BuildTarget.Android) {
HandleAndroidBundleVersionCode();
HandleAndroidKeystore();
}
......@@ -159,6 +161,20 @@ static class BuildCommand
Console.WriteLine(":: Done with build");
}
private static void HandleAndroidBundleVersionCode()
{
if (TryGetEnv(ANDROID_BUNDLE_VERSION_CODE, out string value))
{
if (int.TryParse(value, out int version))
{
PlayerSettings.Android.bundleVersionCode = version;
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected, set the bundle version code to {value}.");
}
else
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected but the version value \"{value}\" is not an integer.");
}
}
private static void HandleAndroidKeystore()
{
#if UNITY_2019_1_OR_NEWER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment