mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 07:50:13 +00:00
chore: release v0.9.38 (#7594)
* fix(scripts): release:prepare refuses a baseline that skips a release whose tag this clone lacks * chore: release v0.9.38
This commit is contained in:
@@ -3,6 +3,7 @@ import { describe, it } from "node:test";
|
||||
import {
|
||||
escapeForMdx,
|
||||
findSkippedReleaseTags,
|
||||
releaseVersionsInSubjects,
|
||||
parseArgs,
|
||||
parseCommit,
|
||||
renderCommitBullet,
|
||||
@@ -151,6 +152,28 @@ describe("skipped release tags", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("releases found by their commit", () => {
|
||||
it("reads the version of each release commit, squash-merge suffix or not", () => {
|
||||
assert.deepEqual(
|
||||
releaseVersionsInSubjects([
|
||||
"fix(core): a change (#1)",
|
||||
"chore: release v0.9.37 (#7578)",
|
||||
"chore: release v0.9.36",
|
||||
"chore: release v0.9.35-alpha.1",
|
||||
]),
|
||||
["0.9.37", "0.9.36"],
|
||||
);
|
||||
});
|
||||
|
||||
it("names a release whose tag this clone never fetched", () => {
|
||||
// The v0.9.38 cut: tags v0.9.32 to v0.9.37 were missing, so describe chose v0.9.31.
|
||||
const released = releaseVersionsInSubjects(["chore: release v0.9.37 (#7578)"]);
|
||||
assert.deepEqual(findSkippedReleaseTags(["0.9.31", ...released], "v0.9.31", "0.9.38"), [
|
||||
"0.9.37",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("release tags", () => {
|
||||
it("names Release once, even when a commit is scoped to the release itself", () => {
|
||||
const commits = [
|
||||
|
||||
@@ -221,7 +221,7 @@ function resolvePreviousTag(versionTag: string, to: string, version: string) {
|
||||
fail("Could not resolve the previous release tag. Pass --from <tag> explicitly.");
|
||||
}
|
||||
// Only guards an auto-resolved baseline; an explicit --from never reaches here.
|
||||
assertNoSkippedTags(from, version);
|
||||
assertNoSkippedTags(from, version, ref);
|
||||
return from;
|
||||
}
|
||||
|
||||
@@ -260,13 +260,27 @@ function listStableTags(): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
function assertNoSkippedTags(from: string, version: string) {
|
||||
const skipped = findSkippedReleaseTags(listStableTags(), from, version);
|
||||
/** Versions of the `chore: release vX.Y.Z` commits in `subjects`, tagged here or not. */
|
||||
export function releaseVersionsInSubjects(subjects: string[]): string[] {
|
||||
return subjects.flatMap((subject) => {
|
||||
const match = /^chore: release v(\d+\.\d+\.\d+)(?: \(#\d+\))?$/.exec(subject);
|
||||
return match ? [match[1]!] : [];
|
||||
});
|
||||
}
|
||||
|
||||
/** Releases whose commit is in `from..ref`, so a clone without their tags still sees them. */
|
||||
function listReleasedVersions(from: string, ref: string): string[] {
|
||||
return releaseVersionsInSubjects(git(["log", "--format=%s", `${from}..${ref}`]).split("\n"));
|
||||
}
|
||||
|
||||
function assertNoSkippedTags(from: string, version: string, ref: string) {
|
||||
const known = [...new Set([...listStableTags(), ...listReleasedVersions(from, ref)])];
|
||||
const skipped = findSkippedReleaseTags(known, from, version);
|
||||
if (skipped.length === 0) return;
|
||||
const names = skipped.map((tag) => `v${tag}`).join(", ");
|
||||
fail(
|
||||
`Baseline v${from.replace(/^v/, "")} skips ${names} — tagged locally, but not in this history.\n` +
|
||||
"Those tags are stale, so the draft would re-list work that already shipped.\n\n" +
|
||||
`Baseline v${from.replace(/^v/, "")} skips ${names} — released in this history, but the tag is stale or missing here.\n` +
|
||||
"The draft would re-list work that already shipped.\n\n" +
|
||||
" git fetch origin --tags --force\n\n" +
|
||||
"Then re-run. Pass --from <tag> to override when the baseline is deliberate.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user