We recommend installing semantic-release directly in the CI environment as part of executing with npx:
npx semantic-release
If you need to leverage plugins and/or presets that are not included in the base semantic-release package, you can install them part of executing with npx as well:
npx --package semantic-release --package @semantic-release/exec --package conventional-changelog-conventionalcommits semantic-release
npx, we recommend setting at least the major semantic-release version to install.
For example, by using npx semantic-release@25.
This way you control which major version of semantic-release is used by your pipeline, and thus avoid breaking the release when there’s a new major version of semantic-release.{
"customManagers": [
{
"customType": "regex",
"description": "Update semantic-release version used by npx",
"managerFilePatterns": ["^\\.github/workflows/[^/]+\\.ya?ml$"],
"matchStrings": ["\\srun: npx semantic-release@(?<currentValue>.*?)\\s"],
"datasourceTemplate": "npm",
"depNameTemplate": "semantic-release"
}
]
}
npx is a tool bundled with npm@>=5.2.0. You can use it to install (and run) the semantic-release binary.
See What is npx for more details.Since semantic-release isn’t truly a development dependency, but rather a release dependency, we recommend avoiding installation as a local dependency of your project. Instead, we recommend installing it globally in your CI environment as part of executing with npx as described above. Installing only during the release process avoids:
node_modules/ than the one used to run the release, which can lead to conflicts and unexpected behavior