Skip to content

Commit 347cd2f

Browse files
committed
Update publish-npm.yml
1 parent 9d05780 commit 347cd2f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/publish-npm.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ jobs:
111111
fi
112112
# Use path.resolve to safely construct the absolute path
113113
VERSION=$(node -e "const path = require('path'); const pkgPath = path.resolve('$PKG_DIR', 'package.json'); const pkg = require(pkgPath); console.log(pkg.version);")
114+
if [ -z "$VERSION" ]; then
115+
echo "❌ Failed to extract version from $PKG_DIR/package.json. Ensure the file exists and contains a valid 'version' field." >&2
116+
exit 1
117+
fi
114118
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
115119
echo "Extracted version: $VERSION from $PKG_DIR/package.json"
116120
shell: bash

0 commit comments

Comments
 (0)