Skip to content

Commit

Permalink
fix(ci): deploy_npm script (#5817)
Browse files Browse the repository at this point in the history
Add a check at the end of deploy_npm script to ensure it's been
correctly deployed before moving on.
  • Loading branch information
spypsy authored Apr 17, 2024
1 parent d7486a6 commit df1c3c4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions build-system/scripts/deploy_npm
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit df1c3c4

Please sign in to comment.