|
1 | | -# github-release-notes |
| 1 | +# Github Release Notes |
2 | 2 |
|
3 | 3 | [](https://badge.fury.io/js/github-release-notes) |
| 4 | +[](http://standardjs.com) |
| 5 | +[](https://travis-ci.org/github-tools/github-release-notes) |
4 | 6 |
|
5 | | -> Node module which generates a release from the latest tag and compiles release notes based on commit messages between the last tag and the latest release. |
| 7 | +> Node module that generates release notes based on commit messages or closed issues between tags. It also can create a full changelog or add the latest release notes to the existing changelog file. |
6 | 8 |
|
7 | 9 | ## Installation |
8 | 10 |
|
9 | | -The plugin requires Node `^0.12.`, since is using Promises. |
10 | | - |
11 | 11 | Install `github-release-notes` via npm: |
12 | 12 |
|
13 | 13 | ```shell |
14 | | -npm install github-release-notes --save-dev |
| 14 | +npm install github-release-notes -g |
15 | 15 | ``` |
16 | 16 |
|
17 | 17 | ## Usage |
18 | 18 |
|
19 | | -You can run the command via the terminal (the three arguments are all required): |
| 19 | +**gren** can be ran through the terminal, but before you can use it, you need to set up a couple of things. |
| 20 | + |
| 21 | +### Github Informations |
| 22 | + |
| 23 | +**gren** by default looks for your local git configuration to get the repo informations. This means you can run the command directly from the git repo folder. |
| 24 | + |
| 25 | +Otherwise, you can run it from wherever and specify a different repo as target, with: |
20 | 26 |
|
21 | 27 | ```shell |
22 | | -node github-release-notes --token=[token] --username=[username] --repo=[repo name] |
| 28 | +gren --username=[username] --repo=[repo name] |
| 29 | +``` |
| 30 | + |
| 31 | +#### Token |
| 32 | + |
| 33 | +To work, **gren** needs a `github token` (that can be easily generated following [this link](https://help.github.com/articles/creating-an-access-token-for-command-line-use/)). _You only need "repo" scope._ |
| 34 | + |
| 35 | +Once generated, you can run the gren command with the token as variable: |
| 36 | + |
| 37 | +```shell |
| 38 | +gren --token=your_token_here |
| 39 | +``` |
| 40 | + |
| 41 | +Or you can add it to your `~/.bash_profile` or `~/.zshrc`) as follows: |
| 42 | + |
| 43 | +```shell |
| 44 | +export GREN_GITHUB_TOKEN=your_token_here |
| 45 | +``` |
| 46 | + |
| 47 | +And you're ready to use it! Just run this command in your terminal: |
| 48 | + |
| 49 | +```shell |
| 50 | +gren |
| 51 | +``` |
| 52 | + |
| 53 | +The module will look for the last tag, get all the issues closed in the time between that tag and the one before, and it will build release notes and draft the new release! |
| 54 | + |
| 55 | +## Options |
| 56 | + |
| 57 | +Following the options for the module: |
| 58 | + |
| 59 | +- `--action=release|changelog` The **gren** action to run. Default: `release` _(see details below for changelog generator)_ |
| 60 | +- `--tags=0.1.0|0.2.0,0.1.0` A specific tag or the range of tags to build the release notes from. |
| 61 | +- `--time-wrap=latest|history` The release notes you want to include in the changelog. Default: `latest` _Only applicable to the `changelog` action_ |
| 62 | +- `--changelog-filename=CHANGELOG.md` The name of the changelog file. Default: `CHANGELOG.md` |
| 63 | +- `--data-source=issues|commits` The informations you want to use to build release notes. Default: `issues` |
| 64 | +- `--draft=true|false` To set the release as a draft. Default: `false` |
| 65 | +- `--prerelease=true|false` To set the release as a prerelease. Default: `false` |
| 66 | +- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1`. Default: `null` |
| 67 | +- `--include-messages=merges|commits|all` used to filter the messages added to the release notes. Default: `commits` |
| 68 | +- `--override=true|false` Override the release notes if existing. Default: `false` |
| 69 | + |
| 70 | +## Examples |
| 71 | + |
| 72 | +The ways to use **gren** are various. |
| 73 | + |
| 74 | +### Simple |
| 75 | + |
| 76 | +The simple way, just looks for the last tag, gets all the issues closed between that tag and the one before and creates the new release with the generated body. |
| 77 | + |
| 78 | +``` |
| 79 | +gren |
23 | 80 | ``` |
24 | 81 |
|
25 | | -To generate a github token, follow [this link](https://help.github.com/articles/creating-an-access-token-for-command-line-use/); |
| 82 | +### Commit messages |
26 | 83 |
|
27 | | -### Optionals |
| 84 | +Adding the flag `--data-source=commits` will change the source of the release notes to be the commit messages. |
28 | 85 |
|
29 | | -There are optional arguments such as: |
| 86 | +``` |
| 87 | +gren --data-source=commits |
| 88 | +``` |
| 89 | + |
| 90 | +### Release specific tags |
| 91 | + |
| 92 | +The flag `--tags` accepts one or two tags. |
| 93 | +If you only give one tag, it will get the issues (or commit messages) between that tag and the one before. |
| 94 | +If you give two tags it will generate the release notes with the issues (or commit messages) between those two tag dates. |
| 95 | + |
| 96 | +``` |
| 97 | +gren --tags=2.0.0,1.0.0 |
| 98 | +``` |
| 99 | + |
| 100 | +### Override an existing release |
| 101 | + |
| 102 | +If you trying to create an existing release, **gren** will throw an error *"0.3.0 is a release, use --override flag to override an existing release!* |
| 103 | +If you want then to override, simple use: |
| 104 | + |
| 105 | +``` |
| 106 | +gren --override --tags=0.3.0 |
| 107 | +``` |
| 108 | + |
| 109 | + |
| 110 | +## Changelog Generator |
| 111 | + |
| 112 | +**gren** can also update generate the changelog. |
| 113 | + |
| 114 | +The following command, will generate the release notes for the latest release, and add it to an existing file or create it in the same directory where you run the command. |
| 115 | + |
| 116 | +```shell |
| 117 | +gren --action=changelog |
| 118 | +``` |
| 119 | + |
| 120 | +The generated release notes will be added at the top of the file, and will look like this: |
| 121 | + |
| 122 | +> # Changelog |
| 123 | +## v0.4.3 (02/03/2016) |
| 124 | +[**bug**] This is a issue name [#123](https://github.com/github-tools/github-tools) |
| 125 | + |
| 126 | +### Generate a full changelog |
| 127 | + |
| 128 | +If tou want to generate the whole changelog, you need to use the `--time-wrap=history`. This will generate a changelog based on issues (or on commit messages if the `--data-source=commits` is present). |
| 129 | + |
| 130 | +If you want to override the existing changelog, use `--override`. |
| 131 | + |
| 132 | +The usage would then be: |
| 133 | + |
| 134 | +``` |
| 135 | +gren --time-wrap=history --override |
| 136 | +``` |
30 | 137 |
|
31 | | -- `--draft=true` To set the release as a draft. Default: `false` |
32 | | -- `--prerelease=true` To set the release as a prerelease. Default: `false` |
33 | | -- `--prefix=v` Add a prefix to the tag version `e.g. v1.0.1` |
34 | | -- `--include-messages=merges/commits/all` used to filter the messages added to the release notes. Default: `commits` |
| 138 | +To see a full example of the changelog here [CHANGELOG.md](https://github.com/github-tools/github-release-notes/blob/develop/CHANGELOG.md) |
0 commit comments