387784c7bd
Replace changesets with a simple, stateless release system: Stable release (PR-gated): Actions → "create release PR" → pick patch/minor/major → CI runs → merge → publishes to npm, creates git tag + GitHub Release Prerelease (ad-hoc): Actions → "publish / prerelease" → publishes current version with -canary.<suffix|timestamp> to npm under "canary" tag Key features: - All 12 core @copilotkit/* packages share a single version - AI-generated release notes via Anthropic API - Notion draft for team editing before merge - Notion link commented on the release PR - Guards: concurrent release PR check, version > npm check, clean semver check, canary-only prerelease tag - release/publish/v* branch pattern (hard to accidentally match) - TypeScript throughout (tsx runner) - release.config.json with versionedTogether/versionedIndependently
67 lines
1.4 KiB
TypeScript
67 lines
1.4 KiB
TypeScript
import { spawnSync } from "child_process";
|
|
import { ROOT } from "./config.js";
|
|
|
|
export function getLastReleaseTag(): string | null {
|
|
const result = spawnSync(
|
|
"git",
|
|
["tag", "--list", "v*", "--sort=-v:refname"],
|
|
{ cwd: ROOT, encoding: "utf8" },
|
|
);
|
|
const tags = result.stdout.trim().split("\n").filter(Boolean);
|
|
|
|
for (const tag of tags) {
|
|
if (/^v\d+\.\d+\.\d+$/.test(tag)) {
|
|
return tag;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
export interface Commit {
|
|
hash: string;
|
|
subject: string;
|
|
}
|
|
|
|
export function getCommitsSinceLastRelease(): Commit[] {
|
|
const lastTag = getLastReleaseTag();
|
|
const range = lastTag ? `${lastTag}..HEAD` : "HEAD";
|
|
|
|
const result = spawnSync(
|
|
"git",
|
|
["log", range, "--oneline", "--no-merges", "--format=%H %s"],
|
|
{ cwd: ROOT, encoding: "utf8" },
|
|
);
|
|
|
|
return result.stdout
|
|
.trim()
|
|
.split("\n")
|
|
.filter(Boolean)
|
|
.map((line) => {
|
|
const spaceIdx = line.indexOf(" ");
|
|
return {
|
|
hash: line.slice(0, spaceIdx),
|
|
subject: line.slice(spaceIdx + 1),
|
|
};
|
|
});
|
|
}
|
|
|
|
export interface ChangesSummary {
|
|
lastTag: string | null;
|
|
commitCount: number;
|
|
commits: Commit[];
|
|
oneline: string;
|
|
}
|
|
|
|
export function getChangesSummary(): ChangesSummary {
|
|
const lastTag = getLastReleaseTag();
|
|
const commits = getCommitsSinceLastRelease();
|
|
|
|
return {
|
|
lastTag,
|
|
commitCount: commits.length,
|
|
commits,
|
|
oneline: commits.map((c) => `- ${c.subject}`).join("\n"),
|
|
};
|
|
}
|