A plugin for semantic-release to support publishing packages to npm with yarn@berry and later. Inspired by @suin's package of a similar name.
Step | Description |
---|---|
verifyConditions |
Verify the presence of the NPM_TOKEN environment variable and verify the authentication method is valid. |
prepare |
Update the package.json version and create the npm package tarball. |
publish |
Publish the npm package to the registry. |
$ yarn add -D @dmeents/semantic-release-yarn
Start by adding the plugin to the semantic-release configuration file:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@dmeents/semantic-release-yarn"
]
}
Variable | Required | Description |
---|---|---|
NPM_TOKEN | ✅ | The npm token to use to publish to the registry. It must be created using two-factor authentication auth-only because semantic-release won't work with anything else |
Packages will be published to the registry specified in the package.json file
Your repository must be using
yarn@berry
and have a.yarnrc.yml
file.
Option | Required | Default | Description |
---|---|---|---|
npmPublish | ❌ | true | Should the package be published to the registry provided in the package.json file. |
tarballDir | ❌ | . | The location and filename of where to output the tarball generated by Yarn. As an example, this can be used to include the tarball in the @semantic-release/github plugin. |
changeVersion | ❌ | true | Determines if the plugin should update the package.json file as part of the Prepare step. |
In this example we are using this plugin to simply generate the tarball with npm and releasing it with GitHub. We are
also not allowing the plugin to update the version in the package.json
.
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@dmeents/semantic-release-yarn",
{
"npmPublish": false,
"changeVersion": false,
"tarballDir": "dist"
}
],
[
"@semantic-release/github",
{
"assets": "dist/*.tgz"
}
]
]
}