Testing semantic-release with Dry Run Mode
Learn how to test your semantic-release configuration without actually publishing anything. Use dry-run mode and CI verification to validate your setup before going live.
Detailed Explanation
Testing Your Configuration Safely
Before enabling semantic-release in production, you can test the entire workflow without publishing, tagging, or modifying any files using the dry-run flag.
Running a Dry Run
npx semantic-release --dry-run
This command:
- Analyzes your commits since the last release
- Determines what the next version would be
- Generates release notes
- Shows what each plugin would do
- Does not publish, tag, commit, or modify anything
Dry Run Configuration
You can also set dry run in your config file for testing:
{
"branches": ["main"],
"dryRun": true,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
CI Environment Detection
semantic-release checks for CI environment variables before running. For local testing, you may need to set:
CI=true npx semantic-release --dry-run
Verify Conditions
The verifyConditions step checks that all required tokens and permissions are available. During dry run, some plugins still verify conditions:
- npm: Checks NPM_TOKEN is valid
- github: Checks GITHUB_TOKEN has necessary permissions
Common Testing Workflow
- Configure semantic-release in a feature branch
- Run
npx semantic-release --dry-run --branches feature-branch - Review the output to verify correct version bumps
- Check that release notes include the expected commits
- Merge to main and let the real release happen
Debug Output
For detailed debugging information:
DEBUG=semantic-release:* npx semantic-release --dry-run
This shows the internal decision-making process, including which commits matched which rules.
Use Case
Teams setting up semantic-release for the first time who want to validate their configuration, verify token permissions, and preview version bumps before enabling automated publishing in production CI pipelines.
Try It — Semantic Release Config Builder
Related Topics
Basic npm Package Release with semantic-release
Basic Configuration
Custom Commit Type Release Rules for semantic-release
Advanced Configuration
Custom Shell Commands with @semantic-release/exec
Plugin Configuration
Using conventionalcommits Preset with semantic-release
Plugin Configuration
Prerelease Branch Configuration for semantic-release
Basic Configuration