I would like to ensure that code merged via merge request in a GitLab from the feature branch to our develop branch has always a new unique version (gitflow strategy).
Version currently stored as the part of the code and depends on the project language: (ex: JavaScript it's package.json)
Version suppose to be used for:
- Docker image tag
- Package/code/library bundle
- Displayed to the user and added to the release notes.
I am having a few strategies in mind
Scenario 1
- Add checklist template to the merge request so reviewer has to mark checbox that version was increased.
- Additionally to the previous manual step I would like to have CI/CD step for the validation: Ex: need to check previous version of commit with a new one to ensure that pending merge request has greater version than previous. Any clues whether it's possible to determine?
Scenario 2
- CI/CD on a develop branch should automatically increase version of the package and commit. Not sure whether this possible and whether ad-hoc commit will no trigger CI/CD again. (can a problem to handle hotfixes)
I would appreciate any suggestions and your ideas. BR