1 | # @semantic-release/changelog
|
2 |
|
3 | [**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to create or update a changelog file.
|
4 |
|
5 | [![Build Status](https://github.com/semantic-release/changelog/workflows/Test/badge.svg)](https://github.com/semantic-release/changelog/actions?query=workflow%3ATest+branch%3Amaster) [![npm latest version](https://img.shields.io/npm/v/@semantic-release/changelog/latest.svg)](https://www.npmjs.com/package/@semantic-release/changelog)
|
6 | [![npm next version](https://img.shields.io/npm/v/@semantic-release/changelog/next.svg)](https://www.npmjs.com/package/@semantic-release/changelog)
|
7 |
|
8 | | Step | Description |
|
9 | | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
10 | | `verifyConditions` | Verify the `changelogFile` and `changelogTitle` options configuration. |
|
11 | | `prepare` | Create or update a changelog file in the local project directory with the changelog content created in the [generate notes step](https://github.com/semantic-release/semantic-release#release-steps). |
|
12 |
|
13 | ## Install
|
14 |
|
15 | ```bash
|
16 | $ npm install @semantic-release/changelog -D
|
17 | ```
|
18 |
|
19 | ## Usage
|
20 |
|
21 | The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):
|
22 |
|
23 | ```json
|
24 | {
|
25 | "plugins": [
|
26 | "@semantic-release/commit-analyzer",
|
27 | "@semantic-release/release-notes-generator",
|
28 | [
|
29 | "@semantic-release/changelog",
|
30 | {
|
31 | "changelogFile": "docs/CHANGELOG.md"
|
32 | }
|
33 | ],
|
34 | [
|
35 | "@semantic-release/git",
|
36 | {
|
37 | "assets": ["docs/CHANGELOG.md"]
|
38 | }
|
39 | ]
|
40 | ]
|
41 | }
|
42 | ```
|
43 |
|
44 | With this example, for each release, a `docs/CHANGELOG.md` will be created or updated.
|
45 |
|
46 | ## Configuration
|
47 |
|
48 | ### Options
|
49 |
|
50 | | Options | Description | Default |
|
51 | | ---------------- | ----------------------------------------------------- | -------------- |
|
52 | | `changelogFile` | File path of the changelog. | `CHANGELOG.md` |
|
53 | | `changelogTitle` | Title of the changelog file (first line of the file). | - |
|
54 |
|
55 | ### Examples
|
56 |
|
57 | When used with the [@semantic-release/git](https://github.com/semantic-release/git) or [@semantic-release/npm](https://github.com/semantic-release/npm) plugins the `@semantic-release/changelog` plugin must be called first in order to update the changelog file so the [@semantic-release/git](https://github.com/semantic-release/git) and [@semantic-release/npm](https://github.com/semantic-release/npm) plugins can include it in the release.
|
58 |
|
59 | ```json
|
60 | {
|
61 | "plugins": [
|
62 | "@semantic-release/commit-analyzer",
|
63 | "@semantic-release/release-notes-generator",
|
64 | "@semantic-release/changelog",
|
65 | "@semantic-release/npm",
|
66 | "@semantic-release/git"
|
67 | ]
|
68 | }
|
69 | ```
|