ci(release): drop prepublishOnly hook + ignore-scripts on main publish

The root cause of the previous failure was the package.json
"prepublishOnly": "napi prepublish -t npm" script. When the workflow
ran `npm publish` for the main wickra package it implicitly invoked
that hook, which re-attempted to publish every platform subpackage and
hit 403 "cannot publish over 0.1.2" because they were already on
the registry. The error trail looked like it came from the main
publish step but the failing command was actually the hook.

Two-part fix:
- Remove prepublishOnly entirely from bindings/node/package.json. The
  release workflow already does the per-platform publish itself, in a
  loop, idempotently.
- Belt-and-braces: pass --ignore-scripts when publishing the main
  package so any prepublish-hook drift in the future is suppressed.
This commit is contained in:
kingchenc
2026-05-21 21:43:57 +02:00
parent 827cdc7a6b
commit de39415413
2 changed files with 5 additions and 3 deletions
+5 -2
View File
@@ -244,12 +244,15 @@ jobs:
echo "::notice::skip wickra@$version (already on npm)"
exit 0
fi
npm publish --access public
# --ignore-scripts so any leftover prepublish hooks (which would
# otherwise try to republish the already-published platform
# subpackages) can't sabotage the main publish.
npm publish --access public --ignore-scripts
rc=$?
if [ "$rc" -ne 0 ]; then
echo "::warning::first attempt failed (rc=$rc); retrying after 30s"
sleep 30
npm publish --access public
npm publish --access public --ignore-scripts
rc=$?
fi
exit $rc
-1
View File
@@ -54,7 +54,6 @@
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"artifacts": "napi artifacts",
"prepublishOnly": "napi prepublish -t npm",
"universal": "napi universal",
"version": "napi version",
"test": "node --test __tests__/"