diff --git a/script/release/bin/publish-to-npm.ts b/script/release/bin/publish-to-npm.ts index 484bece93c61..43ae273552d1 100644 --- a/script/release/bin/publish-to-npm.ts +++ b/script/release/bin/publish-to-npm.ts @@ -136,6 +136,20 @@ new Promise((resolve, reject) => { return release; }) + .then(async (release) => { + const gnArgs = await fs.promises.readFile(path.resolve(ELECTRON_DIR, 'build/args/all.gn'), 'utf8'); + + const abiVersionLine = gnArgs.split('\n').find((line) => line.startsWith('node_module_version = ')); + const abiVersion = abiVersionLine ? abiVersionLine.split('=')[1].trim() : null; + if (!abiVersion) { + throw new Error('Could not find node_module_version in GN args'); + } + + const abiVersionFile = path.join(tempDir, 'abi_version'); + await fs.promises.writeFile(abiVersionFile, abiVersion); + + return release; + }) .then(async (release) => { const currentBranch = await getCurrentBranch();