mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:40:44 +00:00
ci: publish ClawHub plugins as ClawPacks
This commit is contained in:
@@ -371,7 +371,29 @@ describe("plugin-clawhub-publish.sh", () => {
|
||||
const clawhubPath = join(binDir, "clawhub");
|
||||
writeFileSync(
|
||||
clawhubPath,
|
||||
`#!/usr/bin/env bash\nprintf '%s\\n' "$@" > ${JSON.stringify(markerPath)}\nexit 0\n`,
|
||||
`#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
printf '%s\\n' "$*" >> ${JSON.stringify(markerPath)}
|
||||
if [[ "\${1:-}" == "package" && "\${2:-}" == "pack" ]]; then
|
||||
pack_destination=""
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--pack-destination)
|
||||
pack_destination="\${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
mkdir -p "$pack_destination"
|
||||
pack_path="$pack_destination/openclaw-demo-plugin-2026.4.1.tgz"
|
||||
printf 'fake tgz\\n' > "$pack_path"
|
||||
printf '{"path":"%s","name":"@openclaw/demo-plugin","version":"2026.4.1"}\\n' "$pack_path"
|
||||
fi
|
||||
exit 0
|
||||
`,
|
||||
);
|
||||
chmodSync(clawhubPath, 0o755);
|
||||
|
||||
@@ -387,13 +409,19 @@ describe("plugin-clawhub-publish.sh", () => {
|
||||
encoding: "utf8",
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCLAW_PLUGIN_NPM_RUNTIME_BUILD: "0",
|
||||
PATH: `${binDir}${delimiter}${process.env.PATH ?? ""}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(output).toContain("Publish command: CLAWHUB_WORKDIR=");
|
||||
expect(readFileSync(markerPath, "utf8")).toContain("--dry-run");
|
||||
expect(output).toContain("Resolved ClawPack:");
|
||||
const invocations = readFileSync(markerPath, "utf8");
|
||||
expect(invocations).toContain("package pack ./extensions/demo-plugin");
|
||||
expect(invocations).toContain("package publish ");
|
||||
expect(invocations).toContain(".tgz --tags latest");
|
||||
expect(invocations).toContain("--dry-run");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user