@@ -228,7 +228,20 @@ jobs:
228228
229229 - name : Install ClawHub CLI dependencies
230230 working-directory : clawhub-source
231- run : bun install --frozen-lockfile
231+ run : |
232+ set -euo pipefail
233+ for attempt in 1 2 3; do
234+ if bun install --frozen-lockfile; then
235+ exit 0
236+ fi
237+ status="$?"
238+ if [[ "${attempt}" == "3" ]]; then
239+ exit "${status}"
240+ fi
241+ echo "bun install failed while preparing ClawHub CLI; retrying (${attempt}/3)."
242+ rm -rf node_modules "${RUNNER_TEMP}/bun-install-cache" || true
243+ sleep $((attempt * 15))
244+ done
232245
233246 - name : Bootstrap ClawHub CLI
234247 run : |
@@ -263,7 +276,7 @@ jobs:
263276 id-token : write
264277 strategy :
265278 fail-fast : false
266- max-parallel : 12
279+ max-parallel : 32
267280 matrix :
268281 plugin : ${{ fromJson(needs.preview_plugins_clawhub.outputs.matrix) }}
269282 steps :
@@ -309,7 +322,20 @@ jobs:
309322
310323 - name : Install ClawHub CLI dependencies
311324 working-directory : clawhub-source
312- run : bun install --frozen-lockfile
325+ run : |
326+ set -euo pipefail
327+ for attempt in 1 2 3; do
328+ if bun install --frozen-lockfile; then
329+ exit 0
330+ fi
331+ status="$?"
332+ if [[ "${attempt}" == "3" ]]; then
333+ exit "${status}"
334+ fi
335+ echo "bun install failed while preparing ClawHub CLI; retrying (${attempt}/3)."
336+ rm -rf node_modules "${RUNNER_TEMP}/bun-install-cache" || true
337+ sleep $((attempt * 15))
338+ done
313339
314340 - name : Bootstrap ClawHub CLI
315341 run : |
@@ -392,3 +418,62 @@ jobs:
392418 PACKAGE_TAG : ${{ matrix.plugin.publishTag }}
393419 PACKAGE_DIR : ${{ matrix.plugin.packageDir }}
394420 run : bash scripts/plugin-clawhub-publish.sh --publish "${PACKAGE_DIR}"
421+
422+ - name : Verify published ClawHub package
423+ env :
424+ CLAWHUB_REGISTRY : ${{ env.CLAWHUB_REGISTRY }}
425+ PACKAGE_NAME : ${{ matrix.plugin.packageName }}
426+ PACKAGE_VERSION : ${{ matrix.plugin.version }}
427+ PACKAGE_TAG : ${{ matrix.plugin.publishTag }}
428+ run : |
429+ set -euo pipefail
430+ node --input-type=module <<'EOF'
431+ const registry = (process.env.CLAWHUB_REGISTRY ?? "https://clawhub.ai").replace(/\/+$/, "");
432+ const packageName = process.env.PACKAGE_NAME;
433+ const packageVersion = process.env.PACKAGE_VERSION;
434+ const packageTag = process.env.PACKAGE_TAG;
435+ if (!packageName || !packageVersion || !packageTag) {
436+ throw new Error("Missing ClawHub package verification env.");
437+ }
438+ const encodedName = encodeURIComponent(packageName);
439+ const encodedVersion = encodeURIComponent(packageVersion);
440+ const detailUrl = `${registry}/api/v1/packages/${encodedName}`;
441+ const versionUrl = `${detailUrl}/versions/${encodedVersion}`;
442+ const artifactUrl = `${versionUrl}/artifact/download`;
443+
444+ async function fetchWithRetry(url, options = {}) {
445+ let lastStatus = "unknown";
446+ for (let attempt = 1; attempt <= 12; attempt += 1) {
447+ const response = await fetch(url, { redirect: "manual", ...options });
448+ lastStatus = response.status;
449+ if (response.status !== 429 && response.status < 500) {
450+ return response;
451+ }
452+ await new Promise((resolve) => setTimeout(resolve, attempt * 5000));
453+ }
454+ throw new Error(`${url} did not stabilize; last status ${lastStatus}.`);
455+ }
456+
457+ const detailResponse = await fetchWithRetry(detailUrl, {
458+ headers: { accept: "application/json" },
459+ });
460+ if (!detailResponse.ok) {
461+ throw new Error(`${detailUrl} returned HTTP ${detailResponse.status}.`);
462+ }
463+ const detail = await detailResponse.json();
464+ const tags = detail?.package?.tags ?? {};
465+ if (tags[packageTag] !== packageVersion) {
466+ throw new Error(
467+ `${packageName}: ClawHub tag ${packageTag} points to ${tags[packageTag] ?? "<missing>"}, expected ${packageVersion}.`,
468+ );
469+ }
470+ const versionResponse = await fetchWithRetry(versionUrl);
471+ if (!versionResponse.ok) {
472+ throw new Error(`${versionUrl} returned HTTP ${versionResponse.status}.`);
473+ }
474+ const artifactResponse = await fetchWithRetry(artifactUrl, { method: "HEAD" });
475+ if (artifactResponse.status < 200 || artifactResponse.status >= 400) {
476+ throw new Error(`${artifactUrl} returned HTTP ${artifactResponse.status}.`);
477+ }
478+ console.log(`${packageName}@${packageVersion} verified on ClawHub.`);
479+ EOF
0 commit comments