npm token for publishing to npm. Trusted publishing is the recommended approach when publishing to the official registry. A token is required when publishing to alternative registries. See CI configuration recipes for setup options.
| -| `GH_TOKEN` or `GITHUB_TOKEN` |GitHub authentication token for publishing releases. See CI configuration recipes for setup options.
| +| Variable | Description | +| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `NPM_TOKEN` |npm token for publishing to npm. Trusted publishing is the recommended approach when publishing to the official registry. A token is required when publishing to alternative registries. See CI configuration recipes for setup options.
| +| `GH_TOKEN` or `GITHUB_TOKEN` |GitHub authentication token for publishing releases. See CI configuration recipes for setup options.
| See each plugin's documentation for the environment variables required. diff --git a/src/content/docs/usage/configuration.md b/src/content/docs/usage/configuration.md index c88103d..0a4bd6a 100644 --- a/src/content/docs/usage/configuration.md +++ b/src/content/docs/usage/configuration.md @@ -1,6 +1,7 @@ --- title: "Configuration" --- + Configure semantic-release options, plugins, and release branches via config files, CLI arguments, or shareable configurations. **semantic-release** configuration consists of: @@ -9,13 +10,13 @@ Configure semantic-release options, plugins, and release branches via config fil - Plugins [declaration](#plugins) and options - Run mode ([debug](#debug), [dry run](#dryrun) and [local (no CI)](#ci)) -All of these options can be configured through config file, CLI arguments or by extending a [shareable configuration](/usage/shareable-configurations). +All of these options can be configured through config file, CLI arguments or by extending a [shareable configuration](/foundation/shareable-configurations). Additionally, metadata of Git tags generated by **semantic-release** can be customized via standard [Git environment variables](#git-environment-variables). ## Configuration file -**semantic-release**’s [options](#options), mode and [plugins](/usage/plugins) can be set via either: +**semantic-release**’s [options](#options), mode and [plugins](/foundation/plugins) can be set via either: - A `.releaserc` file, written in YAML or JSON, with optional extensions: `.yaml`/`.yml`/`.json`/`.js`/`.ts`/`.cjs`/`.mjs` - A `release.config.(js|ts|cjs|mjs)` file that exports an object @@ -24,6 +25,7 @@ Additionally, metadata of Git tags generated by **semantic-release** can be cust The following three examples are the same. Use `master` instead of `main` if your default branch is `master`. - Via `release` key in the project's `package.json` file: + ```json { "release": { @@ -33,6 +35,7 @@ The following three examples are the same. Use `master` instead of `main` if you ``` - Via `.releaserc` file: + ```json { "branches": ["main", "next"] @@ -40,6 +43,7 @@ The following three examples are the same. Use `master` instead of `main` if you ``` - Via `release.config.cjs` file: + ```js /** * @type {import('semantic-release').GlobalConfig} @@ -72,20 +76,21 @@ $ semantic-release --branches next ``` :::note + - CLI arguments take precedence over options configured in the configuration file. - Plugin options cannot be configured through CLI arguments. See [`plugins`](#plugins) for details. -::: + ::: ## Options -The following are **semantic-release** options you can set in the [configuration file](#configuration-file), pass as [CLI arguments](#cli-arguments), or define in a [shareable configuration](/usage/shareable-configurations). +The following are **semantic-release** options you can set in the [configuration file](#configuration-file), pass as [CLI arguments](#cli-arguments), or define in a [shareable configuration](/foundation/shareable-configurations). ### `extends` **type**: `Array`, `String`\ **CLI arguments**: `-e`, `--extends` -List of modules or file paths containing a [shareable configuration](/usage/shareable-configurations). If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration. +List of modules or file paths containing a [shareable configuration](/foundation/shareable-configurations). If multiple shareable configurations are set, they will be imported in the order defined with each configuration option taking precedence over the options defined in a previous shareable configuration. :::note Options defined via CLI arguments or in the configuration file will take precedence over the ones defined in any shareable configuration. @@ -107,6 +112,7 @@ The branches on which releases should happen. By default **semantic-release** wi - pre-releases to the `alpha` distribution channel from the branch `alpha` if it exists :::note + - Branches configuration key accepts [**micromatch**](https://github.com/micromatch/micromatch?tab=readme-ov-file#matching-features) globs. - If your repository does not have a release branch, then **semantic-release** will fail with an `ERELEASEBRANCHES` error message. If you are using the default configuration, you can fix this error by pushing a `main` or `master` branch. - Once **semantic-release** is configured, any user with the permission to push commits on one of those branches will be able to publish a release. It is recommended to protect those branches, for example with [GitHub rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets). @@ -142,7 +148,7 @@ The `tagFormat` must contain the `version` variable exactly once and compile to **default**: `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']`\ **CLI arguments**: `-p`, `--plugins` -Define the list of plugins to use. Plugins will run in series, in the order defined, for each [steps](/intro/#release-steps) if they implement it. +Define the list of plugins to use. Plugins will run in series, in the order defined, for each [release step](/foundation/steps/) whose lifecycle hook they implement. Plugins configuration can defined by wrapping the name and an options object in an array. @@ -150,7 +156,7 @@ Plugins configuration can defined by wrapping the name and an options object in While plugins can be listed by name via the `--plugins` CLI argument, individual plugin options cannot be configured through CLI arguments. If you need to configure plugin options beyond specifying which plugins to use, a [configuration file](#configuration-file) is required. ::: -See [Plugins](/usage/plugins) for more details. +See [Plugins](/foundation/plugins/) for more details. ### `dryRun` @@ -158,7 +164,7 @@ See [Plugins](/usage/plugins) for more details. **default**: `false` if running in a CI environment, `true` otherwise\ **CLI arguments**: `-d`, `--dry-run` -The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following steps: prepare, publish, addChannel, success and fail. In addition to this it prints the next version and release notes to the console. +The objective of the dry-run mode is to get a preview of the pending release. Dry-run mode skips the following lifecycle hooks: `prepare`, `publish`, `addChannel`, `success`, and `fail`. In addition to this it prints the next version and release notes to the console. :::note The Dry-run mode verifies the repository push permission, even though nothing will be pushed. The verification is done to help user to figure out potential configuration issues. diff --git a/src/content/docs/usage/plugins.md b/src/content/docs/usage/plugins.md deleted file mode 100644 index 0c9d133..0000000 --- a/src/content/docs/usage/plugins.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: "Plugins" ---- - -Each [release step](../../#release-steps) is implemented by configurable plugins. This allows for support of different [commit message formats](../../#commit-message-format), release note generators and publishing platforms. - -A plugin is a npm module that can implement one or more of the following steps: - -| Step | Required | Description | -| ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `verifyConditions` | No | Responsible for verifying conditions necessary to proceed with the release: configuration is correct, authentication token are valid, etc... | -| `analyzeCommits` | Yes | Responsible for determining the type of the next release (`major`, `minor` or `patch`). If multiple plugins with a `analyzeCommits` step are defined, the release type will be the highest one among plugins output. | -| `verifyRelease` | No | Responsible for verifying the parameters (version, type, dist-tag etc...) of the release that is about to be published. | -| `generateNotes` | No | Responsible for generating the content of the release note. If multiple plugins with a `generateNotes` step are defined, the release notes will be the result of the concatenation of each plugin output. | -| `prepare` | No | Responsible for preparing the release, for example creating or updating files such as `package.json`, `CHANGELOG.md`, documentation or compiled assets and pushing a commit. | -| `publish` | No | Responsible for publishing the release. | -| `addChannel` | No | Responsible for adding a release channel (e.g. adding an npm dist-tag to a release). | -| `success` | No | Responsible for notifying of a new release. | -| `fail` | No | Responsible for notifying of a failed release. | - -Release steps will run in that order. At each step, **semantic-release** will run every plugin in the [`plugins` array](plugins.md#plugins-declaration-and-execution-order), as long as the plugin implements the step. - -**Note:** If no plugin with a `analyzeCommits` step is defined `@semantic-release/commit-analyzer` will be used. - -## Plugins installation - -### Default plugins - -These four plugins are already part of **semantic-release** and are listed in order of execution. They do not have to be installed separately: - -``` -"@semantic-release/commit-analyzer" -"@semantic-release/release-notes-generator" -"@semantic-release/npm" -"@semantic-release/github" -``` - -### Additional plugins - -[Additional plugins](../extending/plugins-list.md) have to be installed via npm: - -```bash -$ npm install @semantic-release/git @semantic-release/changelog -D -``` - -## Plugins declaration and execution order - -Each plugin must be configured with the [`plugins` options](configuration.md#plugins) by specifying the list of plugins by npm module name. - -```json -{ - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm" - ] -} -``` - -**Note:** If the `plugins` option is defined, it overrides the default plugin list, rather than merging with it. - -For each [release step](../../#release-steps) the plugins that implement that step will be executed in the order in which they are defined. - -```json -{ - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm", - "@semantic-release/git" - ] -} -``` - -With this configuration **semantic-release** will: - -- execute the `verifyConditions` implementation of `@semantic-release/npm` then `@semantic-release/git` -- execute the `analyzeCommits` implementation of `@semantic-release/commit-analyzer` -- execute the `generateNotes` implementation of `@semantic-release/release-notes-generator` -- execute the `prepare` implementation of `@semantic-release/npm` then `@semantic-release/git` -- execute the `publish` implementation of `@semantic-release/npm` - -Order is first determined by release steps (such as `verifyConditions` → `analyzeCommits`). At each release step, plugins are executed in the order in which they are defined. - -## Plugin options configuration - -A plugin configuration can be specified by wrapping the name and an options object in an array. Options configured this way will be passed only to that specific plugin. - -Global plugin configuration can be defined at the root of the **semantic-release** configuration object. Options configured this way will be passed to all plugins. - -```json -{ - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - [ - "@semantic-release/github", - { - "assets": ["dist/**"] - } - ], - "@semantic-release/git" - ], - "preset": "angular" -} -``` - -With this configuration: - -- All plugins will receive the `preset` option, which will be used by both `@semantic-release/commit-analyzer` and `@semantic-release/release-notes-generator` (and ignored by `@semantic-release/github` and `@semantic-release/git`) -- The `@semantic-release/github` plugin will receive the `assets` options (`@semantic-release/git` will not receive it and therefore will use it's default value for that option) diff --git a/src/content/docs/usage/running.mdx b/src/content/docs/usage/running.md similarity index 98% rename from src/content/docs/usage/running.mdx rename to src/content/docs/usage/running.md index d634df9..5e8477b 100644 --- a/src/content/docs/usage/running.mdx +++ b/src/content/docs/usage/running.md @@ -1,6 +1,7 @@ --- title: "Running semantic-release" --- + How to run **semantic-release** in your CI pipeline using `npx`, including version pinning strategies and tradeoffs of local installation. ## Using npx (recommended) @@ -51,7 +52,7 @@ Since **semantic-release** isn't truly a development dependency, but rather a re - installing dependencies that could conflict with other development dependencies, like **commitlint** :::note -A tradeoff of running via `npx` instead of installing locally is that the full **semantic-release** dependency graph is not pinned by your project's lockfile. +A tradeoff of running via `npx` instead of installing locally is that the full **semantic-release** dependency graph is not pinned by your project's lockfile. The [version pinning strategies](#notes) above help mitigate this. -::: \ No newline at end of file +::: diff --git a/src/content/docs/usage/shareable-configurations.md b/src/content/docs/usage/shareable-configurations.md deleted file mode 100644 index 6fa08a3..0000000 --- a/src/content/docs/usage/shareable-configurations.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Shareable configurations" ---- - -A shareable configuration is an [npm](https://www.npmjs.com/) package that exports a **semantic-release** configuration object. It allows for use of the same configuration across several projects. - -The shareable configurations to use can be set with the [extends](configuration.md#extends) option. - -See [shareable configurations list](../extending/shareable-configurations-list.md). diff --git a/src/styles/global.css b/src/styles/global.css index 9086cbc..f550209 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -60,6 +60,7 @@ article.card, .dialog-frame, .pagefind-ui__search-input, dialog-frame, +.sl-link-card, .page-context-action__compact-copy-btn, .page-context-action__compact-scroll-top-btn, .page-context-action__compact-kebab-btn,