From df1c3c4c706a44847b25a66d27544eedc508cf62 Mon Sep 17 00:00:00 2001 From: spypsy Date: Wed, 17 Apr 2024 18:07:36 +0100 Subject: [PATCH] fix(ci): deploy_npm script (#5817) Add a check at the end of deploy_npm script to ensure it's been correctly deployed before moving on. --- build-system/scripts/deploy_npm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/build-system/scripts/deploy_npm b/build-system/scripts/deploy_npm index c4ca396282e..577f074ce09 100755 --- a/build-system/scripts/deploy_npm +++ b/build-system/scripts/deploy_npm @@ -71,3 +71,29 @@ else npm publish $TAG_ARG --access public fi fi + +# Verify deployment +echo "Verifying deployment of version $VERSION with tag $TAG" +END_TIME=$((SECONDS + 300)) # 5 minutes + +while [ $SECONDS -lt $END_TIME ]; do + # Check version and tag + if npm view "$PACKAGE_NAME@$VERSION" version >/dev/null 2>&1; then + # Extract tag info and check + if npm dist-tag ls "$PACKAGE_NAME" | grep -q "$TAG: $VERSION"; then + echo "Version $VERSION with tag $TAG successfully deployed ." + break + else + echo "Version $VERSION is available, but tag $TAG is not correctly set." + fi + else + echo "Waiting for version $VERSION to be available..." + fi + sleep 5 +done + +# Final check to confirm both version and tag are correctly set +if ! npm dist-tag ls "$PACKAGE_NAME" | grep -q "$TAG: $VERSION"; then + echo "Failed to verify the deployment of version $VERSION with tag $TAG within the timeout period." + exit 1 +fi