feat: integrate changesets into existing publish.yml release flow

Remove standalone changeset-release.yml workflow (version bump PR approach).
Instead, run changeset version inside publish.yml's version job to consume
.changeset/*.md files into CHANGELOG.md, then extract the latest section
for GitHub release notes. This replaces the previous AI-generated changelog
(opencode run --command changelog) with changeset-based entries.
This commit is contained in:
Mark IJbema
2026-04-13 12:08:22 +02:00
parent c5115afd29
commit e199c0e0fb
4 changed files with 32 additions and 40 deletions
+1 -1
View File
@@ -22,4 +22,4 @@ Short description of the change for the changelog.
Use `patch` for bug fixes, `minor` for new features, `major` for breaking changes.
Changeset files are consumed when the version bump PR is merged, updating `CHANGELOG.md` and bumping `package.json` versions.
Changeset files are consumed at release time when the `publish.yml` workflow runs, generating changelog entries for the GitHub release notes.
-34
View File
@@ -1,34 +0,0 @@
name: Changeset Release
on:
push:
branches:
- main
workflow_dispatch:
jobs:
changeset-pr-version-bump:
runs-on: ubuntu-latest
if: github.repository == 'Kilo-Org/kilocode'
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-bun
- name: Install dependencies
run: bun install
- name: Changeset Pull Request
id: changesets
uses: changesets/action@v1
with:
commit: "chore: changeset version bump"
title: "chore: changeset version bump"
version: bun run changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+5
View File
@@ -46,9 +46,14 @@ jobs:
- uses: ./.github/actions/setup-bun
# kilocode_change start - install deps for changeset changelog generation
- name: Install dependencies
run: bun install
- name: Install Kilo
if: inputs.bump || inputs.version
run: bun i -g @kilocode/cli
# kilocode_change end
- id: version
run: |
+26 -5
View File
@@ -6,15 +6,22 @@ import { $ } from "bun"
const output = [`version=${Script.version}`]
if (!Script.preview) {
const sha = process.env.GITHUB_SHA ?? (await $`git rev-parse HEAD`.text()).trim()
await $`bun script/changelog.ts --to ${sha}`.cwd(process.cwd())
const file = `${process.cwd()}/UPCOMING_CHANGELOG.md`
const body = await Bun.file(file)
// kilocode_change start - use changesets for changelog generation
// Run changeset version to consume .changeset/*.md files into CHANGELOG.md.
// This also bumps package.json versions, but publish.ts overwrites them with
// Script.version later, so the changeset-computed versions are irrelevant.
await $`bunx changeset version`.nothrow()
// Extract the latest version section from CHANGELOG.md for release notes
const changelog = await Bun.file(`${process.cwd()}/CHANGELOG.md`)
.text()
.catch(() => "No notable changes")
.catch(() => "")
const body = extractLatestSection(changelog) || "No notable changes"
const dir = process.env.RUNNER_TEMP ?? "/tmp"
const notesFile = `${dir}/opencode-release-notes.txt`
await Bun.write(notesFile, body)
// kilocode_change end
await $`gh release create v${Script.version} -d --title "v${Script.version}" --notes-file ${notesFile}`
const release = await $`gh release view v${Script.version} --json tagName,databaseId`.json()
output.push(`release=${release.databaseId}`)
@@ -35,4 +42,18 @@ if (process.env.GITHUB_OUTPUT) {
await Bun.write(process.env.GITHUB_OUTPUT, output.join("\n"))
}
// kilocode_change start - extract latest changelog section for release notes
function extractLatestSection(changelog: string): string {
if (!changelog) return ""
const lines = changelog.split("\n")
// Find first ## heading (version section)
const start = lines.findIndex((line) => /^## /.test(line))
if (start < 0) return ""
// Find the next ## heading after the first one
const end = lines.findIndex((line, i) => i > start && /^## /.test(line))
const section = lines.slice(start + 1, end < 0 ? undefined : end)
return section.join("\n").trim()
}
// kilocode_change end
process.exit(0)