Problem
Publishing npm packages involves a tedious multi-step process: write a changeset, update the changelog, bump the version, open a release PR, merge it, and run npm publish. Each step is a chance for human error -- wrong version bump, forgotten changelog entry, publishing without building first, or forgetting to set the npm auth token.
# The manual dance nobody wants to do
npx changeset
npx changeset version
git add .
git commit -m "chore: version packages"
npm run build
npm publish
git push --follow-tags
Solution
Use Vercel's autoship package to fully automate the release pipeline from changeset creation to npm publish.
1. Install and configure autoship
npm install --save-dev autoship @changesets/cli
npx changeset init
2. Add the GitHub Actions workflow
# .github/workflows/release.yml
name: Release
on:
push:
branches: [main]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- run: npm ci
- name: Create Release PR or Publish
uses: changesets/action@v1
with:
publish: npx autoship
version: npx changeset version
commit: "chore: release packages"
title: "chore: release packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3. Create changesets with AI assistance
Add a skill so your AI agent creates properly formatted changesets:
<!-- skills/changeset.md -->
---
name: create-changeset
description: Create a changeset for the current changes
---
When asked to create a changeset:
1. Run `git diff main --name-only` to see changed packages
2. Determine the bump type (patch for fixes, minor for features, major for breaking)
3. Run `npx changeset` non-interactively by creating the file directly
4. Create `.changeset/{random-name}.md` with YAML frontmatter specifying the package and bump type
4. The automated flow
Developer/AI merges PR with changeset
-> GitHub Action detects changeset files
-> Creates a "Release" PR with version bumps and changelog
-> On merge of Release PR:
-> Builds the package
-> Publishes to npm
-> Creates GitHub release with notes
-> Cleans up changeset files
Why It Works
Autoship wraps the changeset workflow into a single npx autoship command that handles version bumping, changelog generation, building, and publishing in the correct order. The GitHub Action creates a staging PR for releases, giving you a review step before packages go live. This eliminates the most common release errors: forgetting to build, wrong version bumps, and missing changelog entries. The changeset files serve as the source of truth for what changed and how to bump.
Context
- Vercel uses this internally for their open-source packages including the Next.js ecosystem
- The
add-skilltool (npx add-skill) follows this exact release pattern - For monorepos, changesets handle multi-package version coordination automatically
- AI agents can create changeset files directly without the interactive CLI
- Pair with
npm provenancefor supply chain security on published packages - The Release PR pattern gives humans a final review before any package goes public