How to automatically pull the version number? How to automatically pull the version number? symfony symfony

How to automatically pull the version number?


Pulling the version number from somewhere could be difficult, because you could run an older version of the application but wrongly pull the newest version number.

You could add a "release.version" file to your repo that only contains the version number and read this to pass it to the constructor.

Then you can use a git hook like pre-commit to update this file before you commit a tag.

This however is not recommended in distributed systems because it could lead to collisons, but for smaller teams or teams with a dedicated release manager it might be ok.Read here: https://wincent.com/blog/automatic-deployment-numbering-in-gitand How do I enable ident string for Git repos?

It would maybe be enough to have a pre-commit hook that checks for a new tag and just reminds you to increment the version in the code ;).