diff --git a/packages/build_package.js b/packages/build_package.js index 4c414f5675ccc..275f128ccc8ad 100755 --- a/packages/build_package.js +++ b/packages/build_package.js @@ -157,7 +157,12 @@ if (!args.some(arg => arg === '--no-cleanup')) { browser.download = package.browsers.includes(browser.name); await writeToPackage('browsers.json', JSON.stringify(browsersJSON, null, 2)); - // 6. Run npm pack + // 6. Bake commit SHA into the package + const commitSHA = spawnSync('git', ['rev-parse', 'HEAD'], {cwd: __dirname, encoding: 'utf8'}); + console.log(commitSHA.stdout.trim()); + await writeToPackage('commitinfo', commitSHA.stdout.trim()); + + // 7. Run npm pack const shell = os.platform() === 'win32'; const {stdout, stderr, status} = spawnSync('npm', ['pack'], {cwd: packagePath, encoding: 'utf8', shell}); if (status !== 0) { diff --git a/packages/common/.npmignore b/packages/common/.npmignore index 72e9faf9a8672..9bee594746b8a 100644 --- a/packages/common/.npmignore +++ b/packages/common/.npmignore @@ -33,3 +33,5 @@ lib/server/injected/ !protocol.yml # Include browser descriptors. !browsers.json +# Include commit info +!commitinfo