ci: guard main package publish until all platform packages are verified on npm

Prevents publishing gsd-pi to npm if any @gsd-build/engine-* optional
dependency is missing at the expected version. Avoids the failure mode
seen in 2.10.5 where the main package shipped before platform packages
were available, causing 'Cannot find module' errors on fresh installs.
This commit is contained in:
Lex Christopherson 2026-03-13 16:24:07 -06:00
parent 8b9cfae9e9
commit d23b77ff32

View file

@ -145,6 +145,27 @@ jobs:
- name: Wait for npm registry propagation
run: sleep 30
- name: Verify platform packages are published
run: |
VERSION=$(node -p "require('./package.json').version")
echo "Verifying platform packages at version ${VERSION}..."
FAILED=0
for platform in darwin-arm64 darwin-x64 linux-x64-gnu linux-arm64-gnu win32-x64-msvc; do
PKG="@gsd-build/engine-${platform}"
PUBLISHED=$(npm view "${PKG}@${VERSION}" version 2>/dev/null || echo "")
if [ "${PUBLISHED}" = "${VERSION}" ]; then
echo " ✓ ${PKG}@${VERSION}"
else
echo "::error::${PKG}@${VERSION} not found on npm (got: '${PUBLISHED}')"
FAILED=1
fi
done
if [ "${FAILED}" = "1" ]; then
echo "::error::One or more platform packages are missing from npm. Aborting main package publish to prevent broken installs."
exit 1
fi
echo "All platform packages verified."
- name: Publish main package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}