Skip to content

Commit

Permalink
chore: update changelog regex
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed May 28, 2024
1 parent 2a82f40 commit 59608d5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,13 @@ await step('Pushing to GitHub...', async () => {
await step('Creating a new release...', async () => {
const changelog = await Deno.readTextFile('CHANGELOG.md')

let latestChanges =
changelog.match(new RegExp(`## ${escape(newVersion)}.*?\n([\\s\\S]*?)(?=\n## |$)`))?.[1]?.trim() ?? ''

const repoUrl = 'https://github.com/globalbrain/hado'
latestChanges += `\n\n**Full Changelog**: ${repoUrl}/commits/v${newVersion}`
const match = changelog.match(new RegExp(`## \\[${escape(newVersion)}\\]\\((.*?)\\).*?\n([\\s\\S]*?)(?=\n## |$)`))

const url = newGithubReleaseUrl({
repoUrl,
tag: `v${newVersion}`,
body: latestChanges,
body: `${match?.[2]?.trim() ?? ''}\n\n**Full Changelog**: ${match?.[1]?.trim() ?? ''}`,
isPrerelease: (parse(newVersion).prerelease?.length ?? 0) > 0,
repoUrl: 'https://github.com/globalbrain/hado',
tag: `v${newVersion}`,
})

await open(url)
Expand Down

0 comments on commit 59608d5

Please sign in to comment.