mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-24 23:13:35 +08:00
feat(release): write reviewed V2 release notes to CHANGELOG.md (#53964)
This commit is contained in:
@@ -27,6 +27,20 @@ async function prepareReleaseFiles() {
|
||||
await $`bun install`
|
||||
}
|
||||
|
||||
async function writeChangelog() {
|
||||
const notes = process.env["OPENCODE_RELEASE_NOTES"]?.trim()
|
||||
if (!notes) return
|
||||
const file = Bun.file("CHANGELOG.md")
|
||||
const text = await file.text()
|
||||
const lines = text.split("\n")
|
||||
if (lines.some((line) => line === `## ${tag}` || line.startsWith(`## ${tag} `))) return
|
||||
const index = lines.findIndex((line) => line.startsWith("## "))
|
||||
const head = (index === -1 ? lines : lines.slice(0, index)).join("\n").trimEnd()
|
||||
const rest = index === -1 ? "" : lines.slice(index).join("\n")
|
||||
const entry = `## ${tag} — ${new Date().toISOString().slice(0, 10)}\n\n${notes}\n`
|
||||
await file.write(`${head}\n\n${entry}${rest ? `\n${rest}` : ""}`)
|
||||
}
|
||||
|
||||
if (Script.release && !Script.preview) {
|
||||
await $`git fetch origin --tags`
|
||||
await $`git switch --detach`
|
||||
@@ -90,6 +104,7 @@ if (Script.release && !Script.preview) {
|
||||
await $`git fetch origin`
|
||||
await $`git checkout -B v2 origin/v2`
|
||||
await prepareReleaseFiles()
|
||||
await writeChangelog()
|
||||
if ((await $`git diff --quiet`.nothrow()).exitCode !== 0) {
|
||||
// The release already published this code; a push-triggered dev publish of a version bump is wasted work.
|
||||
await $`git commit -am ${`sync release versions for ${tag} [skip ci]`}`
|
||||
|
||||
Reference in New Issue
Block a user