fix(release): track ClawHub publication authorities

This commit is contained in:
Vincent Koc
2026-08-20 23:49:04 -07:00
parent 8ead498f53
commit abc6b15a3b
2 changed files with 31 additions and 4 deletions
+2
View File
@@ -83,6 +83,8 @@ const CLAWHUB_SHARED_RELEASE_INPUT_PATHS = [
"packages/plugin-package-contract/src/index.ts",
"scripts/lib/bounded-response.mjs",
"scripts/lib/npm-publish-plan.mjs",
"scripts/lib/plugin-publication-candidates.ts",
"scripts/lib/plugin-publication-collector.ts",
"scripts/lib/release-version.mjs",
"scripts/lib/plugin-npm-release.ts",
"scripts/lib/plugin-clawhub-release.ts",
+29 -4
View File
@@ -9,7 +9,7 @@ import {
realpathSync,
writeFileSync,
} from "node:fs";
import { delimiter, join } from "node:path";
import { delimiter, dirname, join } from "node:path";
import { gzipSync } from "node:zlib";
import { afterEach, describe, expect, it, vi } from "vitest";
import {
@@ -409,6 +409,24 @@ describe("resolveSelectedClawHubPublishablePluginPackages", () => {
expect(selected.map((plugin) => plugin.extensionId)).toEqual(["demo-plugin", "demo-two"]);
});
it.each([
"scripts/lib/plugin-publication-candidates.ts",
"scripts/lib/plugin-publication-collector.ts",
])("selects all publishable plugins when %s changes", (changedPath) => {
const repoDir = createTempPluginRepo({
extraExtensionIds: ["demo-two"],
});
const { baseRef, headRef } = commitSharedReleaseToolingChange(repoDir, changedPath);
const selected = resolveSelectedClawHubPublishablePluginPackages({
rootDir: repoDir,
plugins: collectClawHubPublishablePluginPackages(repoDir),
gitRange: { baseRef, headRef },
});
expect(selected.map((plugin) => plugin.extensionId)).toEqual(["demo-plugin", "demo-two"]);
});
it("selects all publishable plugins when the shared setup action changes", () => {
const repoDir = createTempPluginRepo({
extraExtensionIds: ["demo-two"],
@@ -2153,11 +2171,18 @@ function createTempPluginRepo(
return repoDir;
}
function commitSharedReleaseToolingChange(repoDir: string) {
function commitSharedReleaseToolingChange(
repoDir: string,
changedPath = "scripts/plugin-clawhub-publish.sh",
) {
const baseRef = git(repoDir, ["rev-parse", "HEAD"]);
mkdirSync(join(repoDir, "scripts"), { recursive: true });
writeFileSync(join(repoDir, "scripts", "plugin-clawhub-publish.sh"), "#!/usr/bin/env bash\n");
const absolutePath = join(repoDir, changedPath);
mkdirSync(dirname(absolutePath), { recursive: true });
writeFileSync(
absolutePath,
changedPath.endsWith(".sh") ? "#!/usr/bin/env bash\n" : "// shared release authority\n",
);
git(repoDir, ["add", "."]);
git(repoDir, [
"-c",