jose/tools/release-notes.js
2021-10-27 17:47:13 +02:00

20 lines
496 B
JavaScript

const fs = require('fs')
const { execSync } = require('child_process')
execSync('git show HEAD -- CHANGELOG.md > CHANGELOG.diff')
const tag = execSync('git tag --points-at HEAD').toString().trim()
fs.writeFileSync(
'notes.md',
fs
.readFileSync('CHANGELOG.diff')
.toString()
.split('\n')
.filter((line) => line.startsWith('+') && !line.startsWith('+++'))
.map((line) => line.substr(1))
.slice(3)
.join('\n'),
)
execSync(`gh release create ${tag} -dF notes.md`)