Skip to content
Go back

Automating Changelog Generation with Changesets

Automating Changelog Generation with Changesets

Introduction

Changesets automate version bumps and changelog generation based on pull request summaries, ensuring consistent semantic versioning.

Prerequisites

Step 1: Install Changesets

pnpm add -D @changesets/cli
pnpm changeset init

This creates a .changeset folder and config files.

Step 2: Creating Changesets

After making changes, run:

pnpm changeset

This generates a markdown file in .changeset/.

Step 3: Generating Changelog and Versions

Run:

pnpm changeset version

Step 4: Committing Changes

Include generated files:

git add package.json **/package.json CHANGELOG.md .changeset
git commit -m "chore: version packages and update changelog"

Step 5: CI Integration

In CI pipeline (GitHub Actions example):

- uses: pnpm/action-setup@v2
  with:
    version: 8
- run: pnpm install
- run: pnpm test
- run: pnpm changeset version
- run: git diff --exit-code || (
    git config user.name "github-actions"
    git config user.email "actions@github.com"
    git commit -am "chore: version packages"
    git push
)

Step 6: Releasing

after pushing version commit, run:

pnpm changeset publish

Summary

Changesets provide automated, consistent semantic versioning and changelog maintenance, reducing manual errors and improving release workflows.


Share this post on:

Previous Post
Configuring ESLint, Prettier, and Husky for Team Projects
Next Post
Using Vitest and Playwright for Full-Stack Testing