How do you manage and automate app versioning?

I use ionic to build my ios app which then will be distributed via xcode.
To build it I simply use the following command:

ionic cordova build ios --prod

Doing this then .xcodeproj will be generated, I use Xcode to continue with the distribution.
Now the thing is, if I made any changes to my ionic project, then I will have to delete the old build first from platforms/ios and generate a new .xcodeproj again.

The version will all be reset again.
I wanted to use script for auto-increment versioning but still…
How do I be able to keep up with the versioning?

I would like to know if there is any other more efficient way on handling versioning.

You can set version and version code’s in the config.xml - if you are a bit experienced you can write a script which can increase those

See:
Cordova Config: https://cordova.apache.org/docs/de/latest/config_ref/

Cordova Hooks: https://cordova.apache.org/docs/de/latest/guide/appdev/hooks/

Thank you for the suggestions!