From 827cdc7a6bbbe9fc2d997b2c76aff8068c5d3e4e Mon Sep 17 00:00:00 2001 From: kingchenc Date: Thu, 21 May 2026 21:39:05 +0200 Subject: [PATCH] ci(release): make the main-package publish step tolerant of 'npm view' 404 GitHub Actions runs shell steps with bash -e, so when npm view wickra@ returned exit 1 (because the package was not yet on the registry) the whole step aborted before reaching npm publish. Switch the step to `set +e` and capture the rc explicitly, so a 404 from npm view is treated as 'not published yet, go publish' instead of a fatal error. Also adds a single retry after 30s for spam-filter blocks. --- .github/workflows/release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a34c303..22dcfb51 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -232,14 +232,27 @@ jobs: working-directory: bindings/node env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + shell: bash run: | + # GitHub Actions defaults to `bash -e`. `npm view` on a not-yet- + # published package returns 1, which would kill the step before + # we got to publish. Force a graceful empty result instead. + set +e version=$(node -p "require('./package.json').version") existing=$(npm view "wickra@$version" version 2>/dev/null) if [ "$existing" = "$version" ]; then echo "::notice::skip wickra@$version (already on npm)" - else - npm publish --access public + exit 0 fi + npm publish --access public + rc=$? + if [ "$rc" -ne 0 ]; then + echo "::warning::first attempt failed (rc=$rc); retrying after 30s" + sleep 30 + npm publish --access public + rc=$? + fi + exit $rc # -------------------------------------------------------------------------- # WASM: wasm-pack build + npm publish (as `wickra-wasm`)