diff options
author | sualko <klaus@jsxc.org> | 2020-05-06 17:15:00 +0300 |
---|---|---|
committer | sualko <klaus@jsxc.org> | 2020-05-06 17:15:00 +0300 |
commit | 55bd48c963dbc11a5b5be19f6d913ebe3cc5b0fb (patch) | |
tree | 91d137699a7dec28b49369947392119f1a36ad7c /scripts | |
parent | b3e84d6b07acbd34a26dad4bd8d04dddc2c4a4f3 (diff) |
chore: update change log generation
ignore doc commits, add scope
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/publish-release.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/publish-release.js b/scripts/publish-release.js index 32773400..2e61cbe9 100644 --- a/scripts/publish-release.js +++ b/scripts/publish-release.js @@ -23,6 +23,8 @@ const files = [ path.join(__dirname, '..', 'archives', `jsxc-${package.version}.tar.gz.sig`), ]; +git.addConfig('versionsort.suffix', '-'); + function pull() { return git.pull('origin', 'master'); } @@ -58,9 +60,11 @@ async function isMasterBranch() { } async function generateChangelog() { - const latestTag = (await git.tags()).latest; + const latestTag = (await git.tags(['--sort=-version:refname'])).latest; const title = `v${package.version}` === latestTag ? '[Unreleased]' : `${package.version} (${new Date().toISOString().split('T')[0]})`; + console.log(`use log between ${latestTag} and HEAD`.verbose); + const logs = await git.log({ from: latestTag, to: 'HEAD', @@ -86,6 +90,10 @@ async function generateChangelog() { const [, type, scope, description] = messageMatches; const entry = { type, scope, description, issues: [] }; + if (['docs'].includes(type)) { + return; + } + if (log.body) { const matches = log.body.match(/(?:fix|fixes|closes?|refs?) #(\d+)/g) || []; @@ -110,7 +118,7 @@ async function generateChangelog() { return `[#${issue}](https://github.com/jsxc/jsxc/issues/${issue})`; }).join(''); - return `- ${issues}${issues.length > 0 ? ' ' : ''}${entry.description}\n`; + return `- ${issues}${issues.length > 0 ? ' ' : ''}${entry.description}${entry.scope ? ` (${entry.scope})`: ''}\n`; } sections.forEach(section => { |