Thejus, in the given example I've mentioned only the steps for git tagging using pipeline. Not mentioned the steps for incrementing the tag.
We can implement our own logic based on the type of tagging that we choose. Because, if we are going with semantic versioning like X.Y.Z tagging (i.e, major-version.minor-version.patch-version), only the developer knows whether the current update is a major version update or a minor version update. In that case, just incrementing the tag version by 1 may not work.
Possible options are:
1. Fetching the version from a version file
2. Can use env variables for major, minor and patch version and automatically increment patch version on all merge/updates. And reset the patch version to 0 if the minor version increments. Apply the same major version, etc.