From 726b730b84830b208725df50fa0251ece1fa199f Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 4 Oct 2026 03:48:35 +0800 Subject: [PATCH] fix(release): tolerate npm registry propagation delay --- .github/workflows/release.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e33120f4c..87a44903e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,7 +112,15 @@ jobs: run: npm run verify:package - name: Publish - run: npm publish --access public + shell: bash + run: | + version="$(node --input-type=module -e 'import packageJson from "./package.json" with { type: "json" }; process.stdout.write(packageJson.version)')" + published_version="$(npm view "rea-agents@${version}" version --json 2>/dev/null || true)" + if [ "${published_version}" = "\"${version}\"" ]; then + echo "rea-agents@${version} is already published; verifying the existing package." + else + npm publish --access public + fi - name: Verify published CLI from npm shell: bash @@ -121,16 +129,20 @@ jobs: verification_root="$(mktemp -d)" trap 'rm -rf -- "${verification_root}"' EXIT cd "${verification_root}" - for attempt in 1 2 3 4 5 6; do - if npm view "rea-agents@${version}" version --json >/dev/null 2>&1 \ - && npm exec --yes --package="rea-agents@${version}" -- rea --help \ - && npm exec --yes --package="rea-agents@${version}" -- rea --llms \ - && node "${GITHUB_WORKSPACE}/scripts/verify-published-package.mjs" "${version}"; then - exit 0 + for attempt in $(seq 1 20); do + published_version="$(npm view "rea-agents@${version}" version --json 2>/dev/null || true)" + if [ "${published_version}" = "\"${version}\"" ]; then + if npm exec --yes --package="rea-agents@${version}" -- rea --help \ + && npm exec --yes --package="rea-agents@${version}" -- rea --llms \ + && node "${GITHUB_WORKSPACE}/scripts/verify-published-package.mjs" "${version}"; then + exit 0 + fi + echo "Published rea-agents@${version} is visible, but CLI verification failed on attempt ${attempt}" >&2 + else + echo "rea-agents@${version} is not visible on npm yet (attempt ${attempt}/20)" >&2 fi - if [ "${attempt}" -lt 6 ]; then - echo "Published package verification attempt ${attempt} failed; retrying in 10 seconds" >&2 - sleep 10 + if [ "${attempt}" -lt 20 ]; then + sleep 15 fi done echo "Published rea-agents@${version} failed registry and CLI verification" >&2