Skip to main content

Command Palette

Search for a command to run...

Automate Versioning and CHANGELOG Generation

In this article, I will explain how to automate versioning and CHANGELOG generation using commit-and-tag-version

Updated
2 min read
Automate Versioning and CHANGELOG Generation

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

  • Git Repository

How to

Installing commit-and-tag-version

npm i -g commit-and-tag-version

Preparing Configuration files

assume you already have git repository

  1. Create configuration file .versionrc

  2. Create version.json file.

  3. Run first release

  4. Test create commit

  5. Run release

example file .versionrc and version.json

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

Run First Release

commit-and-tag-version --first-release

Test Create Commit

You can add a new file and then commit or create an empty commit. To create empty commit, you can follow this example command

git commit --allow-empty -m "feat: add feature A"

Run Release

commit-and-tag-version

After you run first release, you can see CHANGELOG.md file is created and version.json file is update.

If you want to read more about commit-and-tag-version, you can check the github repository.

38 views