diff --git a/scripts/release-sign.js b/scripts/release-sign.js index c082541..f30c631 100644 --- a/scripts/release-sign.js +++ b/scripts/release-sign.js @@ -8,6 +8,36 @@ const path = require('path'); const { execSync } = require('child_process'); const root = path.join(__dirname, '..'); + +// Auto-load .env if present (no dependency on dotenv) +(() => { + try { + const envPath = path.join(root, '.env'); + if (fs.existsSync(envPath)) { + const content = fs.readFileSync(envPath, 'utf8'); + for (const rawLine of content.split(/\r?\n/)) { + const line = rawLine.trim(); + if (!line || line.startsWith('#')) continue; + const cleaned = line.startsWith('export ') + ? line.slice('export '.length).trim() + : line; + const eq = cleaned.indexOf('='); + if (eq === -1) continue; + const key = cleaned.slice(0, eq).trim(); + let val = cleaned.slice(eq + 1).trim(); + if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) { + val = val.slice(1, -1); + } + if (!(key in process.env)) process.env[key] = val; + } + // Do not log secrets; just note that .env was processed + console.log('Loaded environment from .env'); + } + } catch (e) { + console.warn('Warning: Failed to load .env:', e.message); + } +})(); + const pkg = require(path.join(root, 'package.json')); const manifest = require(path.join(root, 'manifest.json')); @@ -60,4 +90,3 @@ try { console.error('Release signing failed:', err.message); process.exit(1); } -