From 17f46b7a158a9a4f9a2ff7c61e74fe5f4b4608b0 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 6 Oct 2026 02:27:34 +0800 Subject: [PATCH] =?UTF-8?q?publish:=20a=20package=20npm=20refuses=20doesn'?= =?UTF-8?q?t=20stop=20the=20ones=20after=20it=20=E2=80=94=20model-map=200.?= =?UTF-8?q?1.1=20(no=20Trusted=20Publisher=20yet)=20answered=20404=20and?= =?UTF-8?q?=20trae=200.2.4,=20after=20it=20in=20the=20list,=20was=20never?= =?UTF-8?q?=20published?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/publish.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index b9bb4cf..f980d5d 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -8,7 +8,9 @@ # first version goes by hand (an npm account of the magpie-community org, # `scripts/publish.sh `), and its Trusted Publisher is set after. Till # then Actions passes it by, publishes the rest, and fails at the end -# naming it. +# naming it. So does a package whose publish npm refuses (one published +# by hand whose Trusted Publisher isn't set yet answers 404): the packages +# after it are still published. set -e cd "$(dirname "$0")/.." # npm's own registry, whatever ~/.npmrc names (a mirror such as npmmirror @@ -28,9 +30,17 @@ for dir in packages/*/; do new="$new $name" continue fi - (cd "$dir" && npm publish --access public ${otp:+--otp="$otp"}) + if ! (cd "$dir" && npm publish --access public ${otp:+--otp="$otp"}); then + [ -n "$GITHUB_ACTIONS" ] && echo "::error::$name@$version wasn't published: is this workflow its Trusted Publisher on npmjs.com?" + refused="$refused $name" + fi done if [ -n "$new" ]; then echo "not published, new to npm:$new" +fi +if [ -n "$refused" ]; then + echo "not published, refused by npm:$refused" +fi +if [ -n "$new$refused" ]; then exit 1 fi