# GitLab Flavored Semantic Versionin ### Goal This project tries to achieve automatic semantic versioning not basing the version bump on the conventional commits standars, but rather on a `Changelog` value on the trailer of commit messages. This works well if a project follows a similar workflow to the one used at GitLab, where each change must not be made on a development branch, never on the release branch and needs to get merged through a merge request. The beauty of this project is that you don't need to use the conventional commits specification, so you can have commits more similar to ``` Added new feature A to address this requirement ``` instead of ``` feat(): added new feature A to address this requirement ``` This translates to: - _**no "wasted" characters for that message prefix**_ - more readable commit messages - a nicer `Changelog` ``` New features: - Added new feature A to address this requirement - Added feature B ``` vs ``` New features: - feat(): added new feature A to address this requirement - feat: added feature B ``` ### Setup The only tool you need to setup this project on your local environment is Ruby, which can be downloaded using `asdf`. The Ruby version required is `2.7.5`. Once Ruby is present on your system you can install the dependencies by running ```shell bundle install ``` ### Testing At the moment there's no built-in testing platform, but I'm planning to use `rspec` to add unit tests. ### Using This project is available as a Ruby gem, so to be able to use it is enough to run ```shell gem install gfsm ``` Once that command completes, the gem will be available and you can invoke it from the command line with ```shell gfsm help ``` The main way this project can be used though, is inside a CI pipeline where you can invoke it to bump the version and/or update the changelog. In order to use is inside a CI job, the job itself could look something like this: ```yaml stages: - version update-version: stage: version image: ruby:2.7.5 before_script: - gem install gfsm script: - gfsm version bump --force > .version - gfsm changelog --force --output-file CHANGELOG.md - echo "RELEASE_VERSION=$(<.version)" >> variables.env artifacts: reports: dotenv: variables.env paths: - .version - CHANGELOG.md ``` With this, subsequent jobs that depend on the `update-version` job will: - be able to get the new version form the `RELEASE_VERSION` environment variable - read the `CHANGELOG.md` file to get an updated changelog file To have a working example of the things described above you can have a look at the `.gitlab-ci.yml` of this project, which implements this exact concept.