stdout - ryan
/ DevOps

Automate Versioning and CHANGELOG Generation

Article

Overview

Assume we have a service/app repository. We want to automate the versioning and CHANGELOG generation. How to achieve this? In this article, I will explain how to automate versioning and CHANGELOG generation using commit-and-tag-version.

Prerequisites

  • commit-and-tag-version app
  • Git Repository

How to

Installing commit-and-tag-version.

npm i -g commit-and-tag-version

Assume you already have git repository.

  1. Create configuration file .versionrc

    // .versionrc
    {
      "packageFiles": [
        {
          "filename": "version.json",
          "type": "json"
        }
      ],
      "bumpFiles": [
        {
          "filename": "version.json",
          "type": "json"
        }
      ]
    }
  2. Create version.json file.

    // version.json
    {
        "version": "1.0.0"
    }
  3. Run first release

    commit-and-tag-version --first-release
  4. Test create commit

    git commit --allow-empty -m "feat: add feature A"
  5. Run release again

    commit-and-tag-version