Skip to content

Commit

Permalink
chore: sort release tags by semver
Browse files Browse the repository at this point in the history
It sorts by date by default. This can make some mess with 0.13 tags.
  • Loading branch information
vvagaytsev committed May 22, 2023
1 parent 05e626c commit 6d61c23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion scripts/draft-release-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ const gardenRoot = resolve(__dirname, "..")

async function getChangelog(prevReleaseTag: string, curReleaseTag: string) {
try {
return (await execa("git-chglog", [`${prevReleaseTag}..${curReleaseTag}`], { cwd: gardenRoot })).stdout
return (
await execa(
"git-chglog",
["--tag-filter-pattern", "^\\d+\\.\\d+\\.\\d+$", "--sort", "semver", `${prevReleaseTag}..${curReleaseTag}`],
{ cwd: gardenRoot }
)
).stdout
} catch (err) {
throw new Error(`Error generating changelog: ${err}`)
}
Expand Down
8 changes: 7 additions & 1 deletion scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,13 @@ async function updateChangelog(version: string) {
const changelogPath = "./CHANGELOG.md";
// TODO: Use readStream and pipe
const changelog = await readFile(changelogPath)
const nextChangelogEntry = (await execa("git-chglog", ["--next-tag", version, version], { cwd: gardenRoot })).stdout
const nextChangelogEntry = (
await execa(
"git-chglog",
["--tag-filter-pattern", "^\\d+\\.\\d+\\.\\d+$", "--sort", "semver", "--next-tag", version, version],
{ cwd: gardenRoot }
)
).stdout
return new Promise((resolve, reject) => {
const writeStream = createWriteStream(changelogPath)
writeStream.write(nextChangelogEntry)
Expand Down

0 comments on commit 6d61c23

Please sign in to comment.