feat(HAI-081): add changesets-based automated versioning and release workflow
- Install and configure @changesets/cli with commit/access settings - Create version PR workflow (.github/workflows/version.yml) for automated version bumps - Update existing release and test-release workflows with version validation - Add example changeset and version tests for CI verification - Add RELEASING.md guide and update README with versioning documentation
This commit is contained in:
46
packages/cli/src/__tests__/version.test.ts
Normal file
46
packages/cli/src/__tests__/version.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { readFileSync, existsSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
|
||||
const repoRoot = join(import.meta.dirname!, "..", "..", "..", "..");
|
||||
|
||||
describe("Changeset configuration", () => {
|
||||
it("should have a valid .changeset/config.json", () => {
|
||||
const configPath = join(repoRoot, ".changeset", "config.json");
|
||||
expect(existsSync(configPath)).toBe(true);
|
||||
|
||||
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
||||
expect(config).toBeDefined();
|
||||
expect(typeof config).toBe("object");
|
||||
});
|
||||
|
||||
it("should have baseBranch set to main", () => {
|
||||
const configPath = join(repoRoot, ".changeset", "config.json");
|
||||
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
||||
expect(config.baseBranch).toBe("main");
|
||||
});
|
||||
|
||||
it("should have changeset scripts in root package.json", () => {
|
||||
const pkgPath = join(repoRoot, "package.json");
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
||||
|
||||
expect(pkg.scripts.changeset).toBe("changeset");
|
||||
expect(pkg.scripts.version).toBe("changeset version");
|
||||
expect(pkg.scripts["release:version"]).toBe("changeset version");
|
||||
});
|
||||
|
||||
it("should have .github/workflows/version.yml with expected content", () => {
|
||||
const workflowPath = join(
|
||||
repoRoot,
|
||||
".github",
|
||||
"workflows",
|
||||
"version.yml",
|
||||
);
|
||||
expect(existsSync(workflowPath)).toBe(true);
|
||||
|
||||
const content = readFileSync(workflowPath, "utf-8");
|
||||
expect(content).toContain("changesets/action");
|
||||
expect(content).toContain("push");
|
||||
expect(content).toContain("main");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user