This guide explains how to publish packages from this monorepo to npm.
- npm account: You need an npm account with 2FA enabled
- Organization membership: Your npm account must be a member of the
@opensourceframeworkorganization - NPM_TOKEN secret: Must be configured in GitHub repository secrets
- Log in to npmjs.com
- Go to your profile picture > Access Tokens
- Click Generate New Token > Classic Token
- Select Automation token type (required for CI/CD)
- Copy the token immediately (you won't be able to see it again)
- Go to the GitHub repository
- Navigate to Settings > Secrets and variables > Actions
- Click New repository secret
- Name:
NPM_TOKEN - Value: Paste your npm access token
- Click Add secret
The token should have the following permissions:
- Read and write access to all packages in the
@opensourceframeworkscope - 2FA must be enabled on your npm account (but bypassed for automation tokens)
This monorepo uses Changesets for versioning and publishing.
-
Make your changes to any package(s)
-
Create a changeset:
pnpm changeset
This will prompt you to:
- Select which packages changed
- Choose the version bump type (major, minor, patch)
- Write a description of the changes
-
Commit the changeset along with your changes
When you're ready to release:
pnpm version-packagesThis will:
- Update package versions based on changesets
- Update CHANGELOG.md files
- Delete used changesets
The release workflow automatically triggers when:
- Changes are pushed to the
mainbranch - The Changesets action creates a "Version Packages" PR
- The PR is merged
For emergency releases, you can manually publish:
# Build all packages
pnpm build
# Publish to npm
pnpm releaseFor canary releases (pre-release versions):
pnpm release:canaryThe automated release process:
graph TD
A[Push to main] --> B[Changesets Action]
B --> C{Changesets exist?}
C -->|Yes| D[Create Version PR]
D --> E[Merge PR]
E --> F[Publish to npm]
C -->|No| G[Skip release]
All packages are published under the @opensourceframework scope:
@opensourceframework/critters@opensourceframework/next-csrf@opensourceframework/next-images@opensourceframework/next-circuit-breaker@opensourceframework/react-a11y-utils@opensourceframework/seeded-rng@opensourceframework/next-json-ld
If you see ENEEDAUTH errors:
- Verify
NPM_TOKENis set correctly in GitHub secrets - Check if the token has expired
- Ensure the token has automation permissions
If you see EPUBLISHCONFLICT:
- The version you're trying to publish already exists
- Run
pnpm version-packagesto bump the version
If you see permission errors for @opensourceframework:
- Verify your npm account is a member of the organization
- Check with org admins for proper permissions