Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,30 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Post-publish smoke test: install the just-published package from the registry
# (clean dir) and confirm it resolves to the expected version. Catches
# "published but unusable" (bad files/exports), wrong dist-tag, or wrong access.
# Post-publish smoke test: install the just-published package from the registry (clean dir)
# and confirm it resolves to the expected version. Catches "published but unusable"
# (bad files/exports/version). The publish already succeeded and npm is immutable, so a
# persistent miss here is a WARNING (registry propagation lag — common on a first publish),
# NOT a release failure. A version MISMATCH after install still hard-fails.
- name: Smoke-test published package
run: |
VERSION="${{ steps.meta.outputs.version }}"
DIST_TAG="${{ steps.meta.outputs.dist_tag }}"
workdir="$(mktemp -d)"
cd "$workdir"
npm init -y >/dev/null
# Registry propagation can lag a few seconds after publish; retry.
for attempt in 1 2 3 4 5 6; do
if npm install "${PROJECT_NAME}@${VERSION}"; then
installed=true
break
fi
echo "install attempt ${attempt} failed; waiting 10s for registry propagation..."
sleep 10
# First publishes propagate slowly; --prefer-online bypasses the negative cache. Back off ~2min.
installed=false
for attempt in 1 2 3 4 5 6 7 8; do
if npm install --prefer-online "${PROJECT_NAME}@${VERSION}"; then installed=true; break; fi
echo "install attempt ${attempt} failed; waiting 15s for registry propagation..."
sleep 15
done
[ "${installed:-false}" = true ] || { echo "::error::Could not install ${PROJECT_NAME}@${VERSION} from the registry."; exit 1; }
node -e "const p = require('${PROJECT_NAME}/package.json'); if (p.version !== '${VERSION}') { throw new Error('installed ' + p.version + ', expected ${VERSION}'); } console.log('smoke ok:', p.name, p.version);"
echo "::notice::Smoke test passed: ${PROJECT_NAME}@${VERSION} installs and resolves (dist-tag ${DIST_TAG})."
if [ "$installed" = true ]; then
node -e "const p = require('${PROJECT_NAME}/package.json'); if (p.version !== '${VERSION}') { throw new Error('installed ' + p.version + ', expected ${VERSION}'); } console.log('smoke ok:', p.name, p.version);"
echo "::notice::Smoke test passed: ${PROJECT_NAME}@${VERSION} installs and resolves (dist-tag ${DIST_TAG})."
else
echo "::warning::${PROJECT_NAME}@${VERSION} published successfully but did not resolve from the registry within the wait window (propagation lag — common on a first publish). Verify manually: npm view ${PROJECT_NAME}@${VERSION} --prefer-online"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading