Skip to content

Latest commit

 

History

History
209 lines (142 loc) · 3.7 KB

File metadata and controls

209 lines (142 loc) · 3.7 KB

Release Guide

This project uses standard-version for versioning and changelog management.

Prerequisites

  • Node.js and pnpm installed
  • Commit access to the repository

Commit Message Convention

We follow Conventional Commits:

Version Bump Rules

Type Description Version Bump
feat: New feature minor (x.y.z)
fix: Bug fix patch (x.y.z)
BREAKING CHANGE: Breaking change major (x.y.z)

All Supported Types

Type Description In Changelog?
feat: New feature Yes
fix: Bug fix Yes
chore: Maintenance No
docs: Documentation No
style: Styles (formatting) No
refactor: Code refactoring No
perf: Performance improvements No
test: Tests No

Examples

git commit -m "feat: add dark mode support"
git commit -m "fix: resolve login redirect issue"
git commit -m "feat: change API response format

BREAKING CHANGE: The API now returns JSON instead of XML"

Bump Version

Auto-detect (based on commits)

pnpm release

standard-version will analyze your commits since last release and determine the appropriate bump.

Using shortcuts

# Patch release (1.2.0 → 1.2.1)
pnpm run release:patch

# Minor release (1.2.0 → 1.3.0)
pnpm run release:minor

# Major release (1.2.0 → 2.0.0)
pnpm run release:major

# Dry run (preview only)
pnpm run release:dry

Force specific version bump

# Specific version
pnpm release -- --release-as 2.0.0

Changelog

CHANGELOG.md is automatically generated when running pnpm release. It includes:

  • All feat: commits under "Features"
  • All fix: commits under "Bug Fixes"
  • Links to commits and issues

Preview changelog without releasing

pnpm release -- --dry-run

Release Process

1. Ensure working directory is clean

git status

2. Run release

pnpm release

This will:

  • Bump version in package.json
  • Update CHANGELOG.md
  • Create a git tag (e.g., v1.2.0)
  • Commit changes

3. Push to remote

git push --follow-tags origin master

The --follow-tags flag pushes both commits and tags.


Publish to npm

Manual publish

After pushing tags:

npm publish

Automated publish

Add to your CI workflow (GitHub Actions example):

name: Release

on:
  push:
    branches: [master]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: pnpm/action-setup@v2
        with:
          version: 8

      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          registry-url: 'https://registry.npmjs.org'

      - run: pnpm install

      - run: pnpm release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

      - run: git push --follow-tags origin master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Create an NPM token at https://www.npmjs.com/settings/[your-username]/tokens and add it as NPM_TOKEN secret in your repository settings.


First Time Setup

If this is your first release:

# Install dependencies
pnpm install

# Create initial release (will bump from 0.0.0 to 1.0.0)
pnpm release -- --release-as minor

Rollback

If something goes wrong:

# Remove the last tag
git tag -d v1.2.0

# Remove the release commit
git reset --hard HEAD~1

# Push the changes
git push --force origin master