fix(ci): strip ANSI codes and match version line in smoke test

The --version flag outputs a banner with ANSI escape codes. The smoke
test compared the entire multi-line output against the bare version
string, causing false failures on every release.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-14 16:56:57 -06:00
parent 888ec0dc59
commit bce3c1457e

View file

@ -220,13 +220,16 @@ jobs:
if npm install "gsd-pi@${VERSION}" 2>&1 | tee /tmp/install-output.txt; then
echo " ✓ Install succeeded"
# Run version check via node directly (npx may resolve wrong binary)
ACTUAL=$(node node_modules/gsd-pi/dist/loader.js --version 2>&1 || echo "FAILED")
# Strip ANSI escape codes and match version on any line (--version prints a banner)
RAW=$(node node_modules/gsd-pi/dist/loader.js --version 2>&1 || echo "FAILED")
ACTUAL=$(echo "$RAW" | sed 's/\x1b\[[0-9;]*m//g' | grep -oE "^${VERSION}$" | head -1)
if [ "$ACTUAL" = "$VERSION" ]; then
echo " ✓ gsd --version = ${VERSION}"
echo "Published package is functional"
exit 0
else
echo "::error::Version mismatch: expected ${VERSION}, got ${ACTUAL}"
echo "::error::Version mismatch: expected ${VERSION} in output:"
echo "$RAW"
exit 1
fi
fi