⬆️ ⬇️

Versioning Automation Tool

Hello!



It was always interesting what product versions are and how to manage them? How to automate version control development? I ask under the cat.







My name is Roman. I am a developer in a very interesting company Softeq, where every person is an inspiration.

')

When developing various tools, I started thinking about whether all developers know what a version is, what meaning it carries and how to manage it during development. So let's look at what versioning is.



Versioning



Versioning - development and management of several product releases that have the same general functionality, but are improved, modernized or individualized.

In short, the version talks about changing the product. How does the version talk about changing the product?

Let's call the character ordering system to designate the product version — the versioning scheme. Different versioning schemes have been created to track different software versions.



image



Semantic versioning



There are a lot of versioning schemes, but we are faced with Semantic Versioning every day. Semantic versioning is characterized by the fact that version numbers and how they change convey the meaning of the source code content and which modifications were applied from one version to another.



Let's consider how the number of the Semantic version is formed.







Let's imagine that we have a project in development. The main task of the project is to manage the building of the library. The project allows you to order materials for building a building, control the stages of building a library. At present, the application architecture has been designed, the basic tasks have been implemented. When testing the functionality of ordering materials for building the library building, an error, bug . The error is corrected and the project version is upgraded.







The customer had an idea about the need to implement the analysis of marketing information in the project. Developers skillfully and quickly designed data analysis services, integrated services with the current architecture. Added the addition of new project functionality, which does not violate backward compatibility . Increased Minor version of the project.







The project was successfully implemented. After some time, the customer had an idea to develop this business automation technology. In the upcoming plans were completely new services: the formation of a team of builders, an internal social network, internal exchange of documents and so on. The developers showed high competence, and after a while the project architecture was designed to solve both new and old tasks. The new architecture of the project has made back incompatible changes. Increased major version of the project.







The full picture looks like this, but you rarely encounter it.


















So, we present what the product version is. But how to manage them?

Let's take a look at the versioning automation tool.



Versionings



NPM: https://www.npmjs.com/package/versionings

GitHub: https://github.com/morozow/versionings



Versioning is done using the command line:



versionings --semver=[<semantic-version> | patch | prepatch | minor | preminor | premajor | prerelease | major] --branch=[<version-branch-name> | any-hyphen-case-less-100-characters-string] [--push] 


The current version of the product is stored in the project's ./package.json file, as well as in the Git tags and the upgrade branch. Automation has the ability to integrate with various third-party tools - versioning is done through the CLI command.



Let's look at an example of upgrading a product.



Actions



A draft of current version 2.5.3 is being developed. The development of a new project service is carried out in the crm-user-service branch. The development of the service was completed, all changes were committed and a decision was made to increase the minor version:



 versionings --semver=minor --branch=user-service --push 


Result



  1. New thread: version / minor / v 2.6.0 - user-service
  2. Changing the version in ./package.json : 2.5.3 -> 2.6.0
  3. Commit new version of the product in the branch version / minor / v 2.6.0 - user-service
  4. Push a new branch with the implementation of the service and an upgraded version of the product.
  5. Creating a pull request for the version / minor / v 2.6.0 branch - user-service , which contains the service implementation and an upgraded version of the product


Remarks





That's all :)



All productive mood and a great day!

Source: https://habr.com/ru/post/433994/



All Articles