github-release-from-cc-changelog
Version:
Create/update Github release notes from a CHANGELOG
93 lines (62 loc) • 2.78 kB
Markdown
[![Build status][build-image]][build-url]
[![Tests coverage][cov-image]][cov-url]
[![npm version][npm-image]][npm-url]
# github-release-from-cc-changelog
Retrieve release notes from CHANGELOG.md (as generated by [standard-version](https://github.com/conventional-changelog/standard-version)) and post them to GitHub
## Installation
```bash
npm i -g github-release-from-cc-changelog
```
## Prerequisites
- Github url needs to be configured at package.json `repository` field
- Ensure GitHub [access token](https://github.com/settings/tokens/new) available at `CONVENTIONAL_GITHUB_RELEASER_TOKEN` (or `GITHUB_TOKEN`) environment variable. The scopes for the token you need is `public_repo` or `repo` (if you need to access private repos).
- Tags for given versions need to exist in GitHub repository before pushing release notes. Tags need to follow format of `v<version>`, or in case of multi-package repositories follow format of `<packageName>@<version>`
## Usage
### CLI
At package directory run:
```bash
github-release-from-cc-changelog <versionTag>
```
e.g.
```bash
github-release-from-cc-changelog v1.0.0
```
#### Resolve and publish notes for all versions
At package directory run:
```bash
github-release-all-from-cc-changelog
```
By default `v` is assumed as tag postfix. In case of multi package repositories this can be overriden by passing `--tag-prefix` e.g.:
```bash
github-release-all-from-cc-changelog --tag-prefix=subpackage@
```
#### Dump release notes for given version
Useful also to verify whether notes for given version can be retrieved
At package directory run:
```bash
dump-release-notes-from-cc-changelog <versionTag>
```
### Programmatically
```javascript
const releaseFromChangelog = require("github-release-from-cc-changelog");
releaseFromChangelog(packageDirectory, versionTag).then(() => {
console.log(`Successfully pushed release notes for "${ versionTag }"`);
});
```
#### Reseolve and publish notes for all versions
```javascript
const releaseAllFromChangelog = require("github-release-from-cc-changelog/all");
releaseFromChangelog(packageDirectory).then(() => {
console.log(`Successfully pushed and released notes for all versions`);
});
```
## Test
```bash
npm test
```
[build-image]: https://github.com/medikoo/github-release-from-cc-changelog/workflows/Integrate/badge.svg
[build-url]: https://github.com/medikoo/github-release-from-cc-changelog/actions?query=workflow%3AIntegrate
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/github-release-from-cc-changelog.svg
[cov-url]: https://codecov.io/gh/medikoo/github-release-from-cc-changelog
[npm-image]: https://img.shields.io/npm/v/github-release-from-cc-changelog.svg
[npm-url]: https://www.npmjs.com/package/github-release-from-cc-changelog