UNPKG

3.45 kBMarkdownView Raw
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[![Travis](https://img.shields.io/travis/semantic-release/changelog.svg)](https://travis-ci.org/semantic-release/changelog)
6[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/changelog.svg)](https://codecov.io/gh/semantic-release/changelog)
7[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/changelog.svg)](https://greenkeeper.io/)
8
9[![npm latest version](https://img.shields.io/npm/v/@semantic-release/changelog/latest.svg)](https://www.npmjs.com/package/@semantic-release/changelog)
10[![npm next version](https://img.shields.io/npm/v/@semantic-release/changelog/next.svg)](https://www.npmjs.com/package/@semantic-release/changelog)
11
12| Step | Description |
13|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
14| `verifyConditions` | Verify the `changelogFile` and `changelogTitle` options configuration. |
15| `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). |
16
17## Install
18
19```bash
20$ npm install @semantic-release/changelog -D
21```
22
23## Usage
24
25The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#configuration):
26
27```json
28{
29 "plugins": [
30 "@semantic-release/commit-analyzer",
31 "@semantic-release/release-notes-generator",
32 ["@semantic-release/changelog", {
33 "changelogFile": "docs/CHANGELOG.md",
34 }],
35 ["@semantic-release/git", {
36 "assets": ["docs/CHANGELOG.md"],
37 }],
38 ]
39}
40```
41
42With this example, for each release, a `docs/CHANGELOG.md` will be created or updated.
43
44## Configuration
45
46### Options
47
48| Options | Description | Default |
49|------------------|-------------------------------------------------------|----------------|
50| `changelogFile` | File path of the changelog. | `CHANGELOG.md` |
51| `changelogTitle` | Title of the changelog file (first line of the file). | - |
52
53### Examples
54
55When 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.
56
57```json
58{
59 "plugins": [
60 "@semantic-release/commit-analyzer",
61 "@semantic-release/release-notes-generator",
62 "@semantic-release/changelog",
63 "@semantic-release/npm",
64 "@semantic-release/git"
65 ],
66}
67```