fix(infra): improve setup.sh publish error handling — distinguish real failures from 409 conflicts

This commit is contained in:
saravanakumardb1 2026-03-24 11:56:26 -07:00
parent 85aca5534b
commit c0bc13e10a

View File

@ -363,12 +363,15 @@ phase5_publish() {
continue
}
# Single publish attempt — "already exists" errors are expected and OK
if (cd "$pkg_dir" && pnpm publish --registry "$registry_url" --no-git-checks 2>&1); then
# Single publish attempt — "already exists" (409) errors are expected and OK
local pub_output
if pub_output=$(cd "$pkg_dir" && pnpm publish --registry "$registry_url" --no-git-checks 2>&1); then
published=$((published + 1))
elif echo "$pub_output" | grep -qi 'already exists\|409\|conflict'; then
published=$((published + 1))
else
# 409 Conflict (already published) is fine; real errors are rare
published=$((published + 1))
warn " Failed to publish ${pkg_name}: $(echo "$pub_output" | tail -1)"
skipped=$((skipped + 1))
fi
done