This document describes the release and publishing process for the B2C CLI monorepo packages.
The project uses:
- Changesets for version management and changelog generation
- npm Trusted Publishers with OIDC for secure, tokenless publishing
- Two-workflow architecture separating version management from publishing
| Type | npm Tag | Trigger | GitHub Release |
|---|---|---|---|
Stable (1.0.0) |
@latest |
Git tag v1.0.0 |
Release |
Pre-release (1.0.0-beta.1) |
@next |
Git tag v1.0.0-beta.1 |
Pre-release |
Nightly (0.0.1-nightly-20250113) |
@nightly |
Scheduled (weekdays) or manual | None |
# Stable release (default)
npm install @salesforce/b2c-cli
# Pre-release (beta, preview, rc)
npm install @salesforce/b2c-cli@next
# Nightly snapshot
npm install @salesforce/b2c-cli@nightlyOnly these three packages are published to npm:
| Package | npm | Description |
|---|---|---|
@salesforce/b2c-cli |
npm | Command line interface |
@salesforce/b2c-tooling-sdk |
npm | SDK/library for B2C operations |
@salesforce/b2c-dx-mcp |
npm | MCP server |
These packages are linked in changesets configuration, meaning they always version together.
Not published:
@salesforce/b2c-plugin-example-config- Example plugin for reference only@salesforce/b2c-cli-root- Monorepo root package
The publish workflow explicitly filters to only these three packages using --filter.
- Trigger: Push to
mainbranch - Purpose: Creates/updates a "Version Packages" PR when changesets exist
- Permissions:
contents: write,pull-requests: write - Does NOT publish - no npm interaction
- Triggers:
- Push of version tags (
v1.0.0,v1.0.0-beta.1, etc.) - stable/pre-releases - Schedule (weekdays at 2 AM UTC) - nightly snapshots
- Manual
workflow_dispatch- on-demand nightly
- Push of version tags (
- Purpose: Publishes packages to npm and creates GitHub Releases (for tag-based releases)
- Permissions:
contents: write,id-token: write(for OIDC) - Security: Uses npm OIDC trusted publishers - no npm token required
When making changes that should be released:
-
Create a changeset describing your changes:
pnpm changeset
-
Select the change type (pre-1.0):
patch- Bug fixes, documentation updates, new featuresminor- New features, major improvementsmajor- Breaking changes: 1.0 --- initial GA release
-
Write a summary - This appears in the changelog
-
Commit the changeset file along with your code changes
-
Open a PR - The changeset file (
.changeset/*.md) should be included
When ready to release:
-
Merge PRs with changesets to
main -
Review the Version PR - The
changesets.ymlworkflow automatically creates a "Version Packages" PR that:- Bumps versions in all
package.jsonfiles - Updates
CHANGELOG.mdfiles - Removes consumed changeset files
- Bumps versions in all
-
Merge the Version PR when ready to release
-
Create and push a version tag:
# Get the new version from package.json VERSION=$(node -p "require('./packages/b2c-tooling-sdk/package.json').version") # Create and push the tag git tag "v$VERSION" git push origin "v$VERSION"
-
Monitor the publish - The
publish.ymlworkflow will:- Validate the tag matches package versions
- Build and test all packages
- Publish to npm via OIDC
- Create a GitHub Release with aggregated changelogs
For pre-release versions, use changesets pre-release mode:
# Enter pre-release mode
pnpm changeset pre enter beta
# Continue normal workflow: create changesets, merge version PR
# Versions will be like 1.0.0-beta.0, 1.0.0-beta.1, etc.
# Exit pre-release mode when ready for stable
pnpm changeset pre exitPre-release tags (v1.0.0-beta.1) publish to @next and create GitHub Pre-releases.
Nightly releases run automatically on weekdays at 2 AM UTC. They can also be triggered manually:
- Go to Actions → Publish to npm workflow
- Click Run workflow
- Select
nightlyand click Run workflow
Nightly versions use changesets snapshot format: 0.0.1-nightly-20250113
Notes:
- Nightly releases do NOT create GitHub releases
- They publish to the
@nightlynpm tag - Each nightly overwrites the previous
@nightlytag
Configuration is in .changeset/config.json:
{
"changelog": ["@changesets/changelog-github", { "repo": "..." }],
"linked": [
["@salesforce/b2c-cli", "@salesforce/b2c-tooling-sdk", "@salesforce/b2c-dx-mcp"]
],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@salesforce/b2c-plugin-example-config"]
}Key settings:
- linked: All three main packages version together
- access: Packages are published as public
- ignore: Example plugin is not published
- updateInternalDependencies: Automatically bumps internal deps
This project uses npm's OIDC trusted publishers instead of npm tokens:
- npm is configured to trust publishes from the
publish.ymlworkflow - GitHub Actions generates a short-lived OIDC token during workflow execution
- The token is automatically used by
pnpm publish- no secrets needed - Provenance attestations are automatically generated
- No token management - No npm tokens to rotate or secure
- Audit trail - Every publish is linked to a specific workflow run
- Provenance - Packages include attestations proving where they were built
- Security - Only the specific workflow can publish, not any repository secret holder
Each package must be configured on npmjs.com:
- Navigate to package → Settings → Publishing access → Trusted Publishers
- Add GitHub Actions trusted publisher:
- Owner:
SalesforceCommerceCloud - Repository:
b2c-developer-tooling - Workflow:
publish.yml - Environment: (leave empty)
- Owner:
The publish.yml workflow validates that the git tag matches the version in package.json. Ensure:
- The "Version Packages" PR was merged
- You pulled the latest
mainbefore tagging - The tag matches exactly (e.g.,
v1.0.0for version1.0.0)
If pnpm changeset status shows no pending changes but you expect some:
- Ensure changeset files exist in
.changeset/(not includingREADME.mdandconfig.json) - Check that the changeset files reference the correct package names
If publishing fails with authentication errors:
- Verify trusted publishers are configured on npmjs.com for all packages
- Ensure the workflow filename matches exactly (
publish.yml) - Check that
id-token: writepermission is set in the workflow
If no "Version Packages" PR appears after merging changesets:
- Check the Actions tab for
changesets.ymlworkflow runs - Verify changesets exist (files in
.changeset/besides config) - Ensure the workflow has necessary permissions
Test what would be published without actually publishing:
pnpm run build
pnpm --filter @salesforce/b2c-tooling-sdk --filter @salesforce/b2c-cli --filter @salesforce/b2c-dx-mcp publish --access public --dry-runNote: Only the three main packages are published. The example plugin and root package are excluded.
See what versions would be bumped:
pnpm changeset version --dry-run