From 5d4edd2d89f5d08f16e1493f4936ff6a85b6c767 Mon Sep 17 00:00:00 2001 From: Tom King Date: Sat, 26 Sep 2026 23:47:31 -0500 Subject: [PATCH] fix(ci): retry npm view instead of fixed sleep in publish verification The verification step slept a fixed 30s then queried the registry once. For 1.13.5, npm publish succeeded (npm info ok) but registry propagation took longer than 30s, so the step 404'd and the workflow run showed failure even though the package was published. Replace the fixed sleep with a retry loop (POSIX sh, up to 30 tries / 15s apart = 7.5 min) and bump the job timeout to accommodate it. --- .github/workflows/publish.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1ea393b..7b249ac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,7 +27,7 @@ jobs: publish: name: "Publish to npm with Provenance" runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 # Only run on main branch to prevent accidental publishes from forks if: github.repository == 'mobilemind/text2datauri' && (github.event_name == 'release' || github.event_name == 'workflow_dispatch') @@ -161,11 +161,20 @@ jobs: if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == 'false') run: | PACKAGE_VERSION="$(node -p "require('./package.json').version")" - echo 'Waiting 30 seconds for npm registry to update...' - sleep 30 - echo "Verifying publication of text2datauri@$PACKAGE_VERSION" - npm view "text2datauri@$PACKAGE_VERSION" version + + # npm publish returns 202 (processing); registry propagation can take + # several minutes, so retry rather than sleep a fixed time. + i=0 + until npm view "text2datauri@$PACKAGE_VERSION" version >/dev/null 2>&1; do + i=$((i + 1)) + if [ "$i" -ge 30 ]; then + echo "❌ text2datauri@$PACKAGE_VERSION not visible on npm after 30 tries" + exit 1 + fi + echo "Not visible on npm yet (try $i/30); retrying in 15 seconds..." + sleep 15 + done echo '✓ Package successfully published and verified' echo "📦 View at: https://www.npmjs.com/package/text2datauri/v/$PACKAGE_VERSION"