This project uses Changesets for automated release management. This document covers the one-time setup and the ongoing release workflow.
This project uses OpenID Connect (OIDC) for secure, token-free publishing to npm. No npm tokens are needed!
Prerequisites:
- Set up OIDC connection in npm:
- Go to https://www.npmjs.com/settings/[username]/tokens
- Navigate to "Publishing Access" → "Granular Access Tokens"
- Click "Configure OIDC" or manage your OIDC connections
- Add a new OIDC connection for this repository:
- Provider: GitHub Actions
- Repository:
[username]/pathist
That's it! GitHub Actions will automatically authenticate with npm using OIDC when publishing.
Ensure the release workflow has proper permissions:
- Go to: Repository Settings → Actions → General
- Under "Workflow permissions", select:
- ✅ Read and write permissions
- ✅ Allow GitHub Actions to create and approve pull requests
When you make changes that should be included in the next release, create a changeset:
pnpm changesetYou'll be prompted to:
-
Select the bump type:
patch- Bug fixes, minor tweaks (0.1.0 → 0.1.1)minor- New features, backwards-compatible (0.1.0 → 0.2.0)major- Breaking changes (0.1.0 → 1.0.0)
-
Write a summary:
- Describe what changed from a user's perspective
- This will appear in the CHANGELOG and GitHub release notes
This creates a markdown file in .changeset/. Commit this file with your changes.
Example:
# Make your changes
git add src/pathist.ts
# Create a changeset
pnpm changeset
# Choose "minor", write: "Add new pathTo() method for searching paths"
# Commit both the code and changeset
git add .changeset/*.md
git commit -m "feat: add pathTo() search method"
git pushWhen you're ready to publish a new version:
# 1. Consume changesets and update version/CHANGELOG
pnpm version-packages
# This will:
# - Update package.json version
# - Generate/update CHANGELOG.md
# - Delete consumed changeset files
# 2. Review the changes
git diff
# 3. Commit and push
git add .
git commit -m "chore: release v$(node -p "require('./package.json').version")"
git push
# 4. GitHub Actions will automatically publish to npmYou don't create this PR manually - the GitHub Actions workflow creates it for you:
-
When you push changesets to
main, the workflow automatically:- Creates/updates a PR titled "Version Packages" (or your configured title)
- Shows the version bump and changelog updates in the PR
- Keeps this PR updated as you add more changesets
-
To release:
- Find the "Version Packages" PR in your repository
- Review the changes (version bump, CHANGELOG updates)
- Merge the PR when ready
- GitHub Actions automatically publishes to npm
Where to find it: Go to your repository → Pull Requests → Look for "Version Packages" or "chore: version packages"
The release workflow (.github/workflows/release.yml) runs and does one of two things:
-
If changeset files exist in
.changeset/:- Automatically creates or updates a PR titled "Version Packages"
- This PR contains:
- Version bump in
package.json - Updated
CHANGELOG.mdwith all changeset summaries - Deletion of consumed changeset files
- Version bump in
- The PR stays open until you merge it
- Adding more changesets will update this same PR
-
If NO changeset files exist (this happens after merging the "Version Packages" PR):
- Builds the package
- Publishes to npm with the new version
- Creates a GitHub release with changelog notes
- Tags the commit with the version number
- 📦 Package is available on npm:
npm install pathist@latest - 🏷️ GitHub release is created with changelog
- 📝 CHANGELOG.md is updated in the repository
After a release is published, verify:
# Check npm
npm view pathist version
npm view pathist
# Test installation
mkdir test-install && cd test-install
npm init -y
npm install pathist
node -e "console.log(require('pathist'))"- Verify OIDC is configured correctly in npm for this repository
- Check that the workflow has
id-token: writepermission (already configured) - Ensure the GitHub Actions identity matches your npm OIDC configuration
- Verify you have publishing rights to the
pathistpackage on npm
- Verify changesets exist:
ls .changeset/*.md(should show files other than README.md) - Check that you pushed to the
mainbranch - Review workflow runs: Actions tab → Release workflow
- Ensure the Release PR was merged (not closed)
- Check workflow logs for errors
- Verify
package.jsonpermissions in workflow settings
- The version might already be published
- Check
npm view pathist versions - Create a new changeset and bump the version again
For testing pre-release versions without publishing:
# Create a snapshot release
pnpm changeset version --snapshot beta
# Publish to npm with a tag
pnpm changeset publish --tag betaThis publishes as pathist@0.1.0-beta-20251127120000 and can be installed with:
npm install pathist@betaIf the automated workflow fails and you need to publish manually:
# 1. Ensure you're on main with latest changes
git checkout main && git pull
# 2. Verify tests pass
pnpm ci
# 3. Build the package
pnpm build
# 4. Publish (you'll be prompted for npm OTP if 2FA is enabled)
npm publish
# 5. Create a git tag
git tag v$(node -p "require('./package.json').version")
git push --tags- Changesets Documentation
- Semantic Versioning
- Conventional Commits (optional, but recommended for commit messages)