diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 887b6fb..158a501 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,10 +90,21 @@ jobs: echo "$NAME@$VERSION is already on the registry - nothing to do" exit 0 fi - if npm publish --provenance --access public; then + out="$RUNNER_TEMP/publish.log" + if npm publish --provenance --access public >"$out" 2>&1; then + cat "$out" echo "published $NAME@$VERSION" exit 0 fi + cat "$out" + # npm view lags a publish by minutes: right after the first version + # went out by hand, it still answers 404 while the registry already + # refuses to publish that version again. Measured on 0.1.0: the tag + # run reached this step two minutes after the hand publish. + if grep -q "cannot publish over the previously published version" "$out"; then + echo "$NAME@$VERSION is already on the registry (npm view does not show it yet) - nothing to do" + exit 0 + fi if npm view "$NAME" version >/dev/null 2>&1; then echo "::error::$NAME is on the registry, but publishing $VERSION failed - see the npm output above (the Trusted Publisher not pointing at this repository and release.yml?)" exit 1