diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5245343e..80e1e55b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,6 +35,7 @@ jobs: with: node-version: "18" cache: pnpm + registry-url: "https://registry.npmjs.org" - name: Install dependencies run: pnpm install - name: Run tests @@ -55,6 +56,7 @@ jobs: with: node-version: "18" cache: pnpm + registry-url: "https://registry.npmjs.org" - run: pnpm install - name: Bump Version id: bump @@ -83,6 +85,7 @@ jobs: with: node-version: "18" cache: pnpm + registry-url: "https://registry.npmjs.org" - name: Install dependencies run: pnpm install - name: Build the site for demo page and embed view diff --git a/scripts/bump-version.js b/scripts/bump-version.js index e0bef9cb..b2c4eece 100755 --- a/scripts/bump-version.js +++ b/scripts/bump-version.js @@ -5,18 +5,20 @@ const path = require("path"); const getCurrentVersion = () => { try { - // Get latest version from npm const pkg = require("../package.json"); - const npmVersion = execSync(`npm view ${pkg.name} version`) + const npmVersion = execSync(`npm view ${pkg.name} version`, { + stdio: ["pipe", "pipe", "pipe"], + }) .toString() .trim(); console.log(`Latest version on npm: ${npmVersion}`); return npmVersion; - } catch (e) { - // Package not published yet, use package.json as fallback - const pkg = require("../package.json"); - console.log("Package not found on npm, using version from package.json"); - return pkg.version; + } catch (error) { + console.error( + "Failed to get npm version. Please ensure you have npm registry access.", + ); + console.error("Error:", error.message); + process.exit(1); } };