Automatic update of patch version on deploy

So we do continuous deployment and would like to use semantic versioning on our modules. We would like to have TeamCity automatically update the patch version on a build when a new commit is built (but without causing a lot of Teamcity generated commits on the repository from the CI system - tags are fine, though).

We want to use the Kotlin DSL, since we're a Kotlin-first group.

One way to do this:

- Major.Minor versions are stored in a text or build file in the repository. These version numbers are always manually updated by the developers (since only the developer can determine when new features are added vs patch/debug updates).

- Patch versions should be automatically incremented on each build. Current patch version can be fetched from the git tags.

- If the tests pass, a tag is created for the current patch version in the repository and the new version is deployed.

I'm thinking this should be possible to do elegantly using the Kotlin DSL, rather than by manual scripting (such as these guys have done: Has anyone else done this and would be willing to share the code?



Please sign in to leave a comment.