2
\$\begingroup\$

I'm building a Godot mobile game and I'm trying to automate the export process.

I can export the game simply enough:

/Applications/Godot.app/Contents/MacOS/Godot --export-release "MyGame-Android" /path-to/mygame-android.aab

This will use the version code that's embedded in export_presets.cfg:

version/code=10

The Play store requires that each new uploaded binary have a new version code. I can write a script that updates this but I'm wondering how other developers are handling this. Is there a common solution?

\$\endgroup\$

2 Answers 2

3
\$\begingroup\$

I just made a Godot plugin to solve exactly this ;)

https://github.com/Robert-K/godot-auto-version-code

It automatically increments all version codes after every non-debug export. The plugin is super simple and can be adjusted to your needs.

It'll be available in the Godot Asset Library shortly (hopefully ^^)..

\$\endgroup\$
1
\$\begingroup\$

This is a Python script I'm using to update the version manually; I'm hoping there's a better way, so I'll post this here as an answer but I won't accept it.

import re

config_file_path = "export_presets.cfg"

with open(config_file_path, 'r') as file:
    content = file.read()

new_content = re.sub(r'version/code=(\d+)',
                     lambda match: f'version/code={int(match.group(1)) + 1}',
                     content)

# Write the updated content back to the file
with open(config_file_path, 'w') as file:
    file.write(new_content)
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .