extract-changelog-release
Extract release notes from latest entry in standard-version changelog.
This project can be used for automating GH releases with standard-version — see GH Actions example.
Usage
CLI
# Extracts from CHANGELOG.md in the current working directory
npx extract-changelog-release
# Extracts from package/CHANGELOG.md relative to CWD
npx extract-changelog-release ./package/CHANGELOG.md
# Extracts from absolute path /path/to/LOG.md
npx extract-changelog-release /path/to/LOG.md
Example Result
$ extract-changelog-release
## [3.2.0](https://github.com/LeDDGroup/typescript-transform-paths/compare/v3.1.0...v3.2.0) (2021-08-03)
### Features
* Support transformation via ts-node transpileOnly and compiler API transformNodes (closes [#123](https://github.com/LeDDGroup/typescript-transform-paths/issues/123)) ([dd942fd](https://github.com/LeDDGroup/typescript-transform-paths/commit/dd942fdbf34afcdec8f976a1540746521a758c73))
### Bug Fixes
* Custom JSDoc tags not working for older TS (fixes [#126](https://github.com/LeDDGroup/typescript-transform-paths/issues/126)) ([d4280c3](https://github.com/LeDDGroup/typescript-transform-paths/commit/d4280c3dec4dc9f3834fc98be2e51109422bd9aa))
Programmatic
import { extractLog } from 'extract-changelog-release';
let releaseNotes: string;
// Extracts from CHANGELOG.md in the current working directory
releaseNotes = extractLog();
// Extracts from package/CHANGELOG.md relative to CWD
releaseNotes = extractLog('package/CHANGELOG.md');
// Extracts from absolute path /path/to/LOG.md
releaseNotes = extractLog('/path/to/LOG.md');
GH Actions
Example config
The following action is triggered when a new version tag is pushed. It will:
- Build
- Test
- Publish to NPM
- Create a GitHub Release based on the latest entry in CHANGELOG.md
.github/workflows/publish.yml
name: Publish
on:
push:
tags:
- v*.*.*
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js 14.x to publish to npmjs.org
uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Install Packages
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Test
run: yarn test
env:
CI: true
- name: Generate Release Body
run: npx extract-changelog-release > RELEASE_BODY.md
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
bodyFile: "RELEASE_BODY.md"
token: ${{ secrets.GITHUB_TOKEN }}