fix(ci): verify deployed version from package.json

This commit is contained in:
Haitao Pan 2026-06-06 14:18:03 +08:00
parent 8aaae6a8db
commit f0ffa62f52

View File

@ -228,8 +228,11 @@ jobs:
fi fi
# Verify the installed version matches the requested version. # Verify the installed version matches the requested version.
INSTALLED="$(npm ls -g "${PLUGIN_NAME}" --depth=0 2>/dev/null \ GLOBAL_ROOT="$(npm root -g)"
| awk -F'[@:]' '/'"${PLUGIN_NAME}"'@/ {print $2; exit}' || true)" INSTALLED=""
if [ -f "${GLOBAL_ROOT}/${PLUGIN_NAME}/package.json" ]; then
INSTALLED="$(node -p "require('${GLOBAL_ROOT}/${PLUGIN_NAME}/package.json').version")"
fi
if [ "${INSTALLED}" != "${VERSION}" ]; then if [ "${INSTALLED}" != "${VERSION}" ]; then
echo "::remote-error::Verification failed: expected ${VERSION}, found ${INSTALLED:-<none>}" echo "::remote-error::Verification failed: expected ${VERSION}, found ${INSTALLED:-<none>}"
exit 1 exit 1