Automating your npm package publishing process with continuous integration and delivery (CI/CD) ensures that each release passes through a quality gate—your test suite—before publication.
Manual npm publishing can be time-consuming and error-prone, particularly as your project grows and gains contributors.
You can control exactly what ends up in the final published package by excluding test files.
Testing ensures you don’t publish broken code.
You want to exclude the node_modules.
While you will run tests during CI, you don’t want the test files included in your published npm package.
With each new release, a comprehensive series of tests run, package.json is updated with the correct version, and a streamlined package is published to npm—free of unnecessary files like tests.
Integrating GitHub Actions into your npm publishing workflow establishes a great CI/CD pipeline.
This approach saves time, reduces human errors, and enhances the reliability of your releases.
A single GitHub release is now all it takes to ship a fully tested, properly versioned package to the npm registry.