ci: improve generated changelog

This commit is contained in:
Daniel Roe 2024-06-13 13:54:49 +01:00
parent cae13aaa24
commit d202669611
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -13,9 +13,9 @@ async function main () {
const commits = await getLatestCommits().then(commits => commits.filter( const commits = await getLatestCommits().then(commits => commits.filter(
c => config.types[c.type] && !(c.type === 'chore' && c.scope === 'deps' && !c.isBreaking), c => config.types[c.type] && !(c.type === 'chore' && c.scope === 'deps' && !c.isBreaking),
)) ))
const bumpType = await determineBumpType() const bumpType = await determineBumpType() || 'patch'
const newVersion = inc(workspace.find('nuxt').data.version, bumpType || 'patch') const newVersion = inc(workspace.find('nuxt').data.version, bumpType)
const changelog = await generateMarkDown(commits, config) const changelog = await generateMarkDown(commits, config)
// Create and push a branch with bumped versions if it has not already been created // Create and push a branch with bumped versions if it has not already been created
@ -44,7 +44,8 @@ async function main () {
changelog changelog
.replace(/^## v.*\n/, '') .replace(/^## v.*\n/, '')
.replace(`...${releaseBranch}`, `...v${newVersion}`) .replace(`...${releaseBranch}`, `...v${newVersion}`)
.replace(/### ❤️ Contributors[\s\S]*$/, ''), .replace(/### ❤️ Contributors[\s\S]*$/, '')
.replace(/[\n\r]+/g, '\n'),
'### ❤️ Contributors', '### ❤️ Contributors',
contributors.map(c => `- ${c.name} (@${c.username})`).join('\n'), contributors.map(c => `- ${c.name} (@${c.username})`).join('\n'),
].join('\n') ].join('\n')