build: ensure get-version runs in the electron git checkout (#36128)
This commit is contained in:
parent
7ca2bb5f9c
commit
b13f776d1b
1 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
const { spawnSync } = require('child_process');
|
const { spawnSync } = require('child_process');
|
||||||
const rootPackageJson = require('../../package.json');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports.getElectronVersion = () => {
|
module.exports.getElectronVersion = () => {
|
||||||
// Find the nearest tag to the current HEAD
|
// Find the nearest tag to the current HEAD
|
||||||
|
@ -11,7 +11,9 @@ module.exports.getElectronVersion = () => {
|
||||||
// The only difference in the "git describe" technique is that technically a commit can "change" it's version
|
// The only difference in the "git describe" technique is that technically a commit can "change" it's version
|
||||||
// number if a tag is created / removed retroactively. i.e. the first time a commit is pushed it will be 1.2.3
|
// number if a tag is created / removed retroactively. i.e. the first time a commit is pushed it will be 1.2.3
|
||||||
// and after the tag is made rebuilding the same commit will result in it being 1.2.4
|
// and after the tag is made rebuilding the same commit will result in it being 1.2.4
|
||||||
const output = spawnSync('git', ['describe', '--tags', '--abbrev=0']);
|
const output = spawnSync('git', ['describe', '--tags', '--abbrev=0'], {
|
||||||
|
cwd: path.resolve(__dirname, '..', '..')
|
||||||
|
});
|
||||||
if (output.status !== 0) {
|
if (output.status !== 0) {
|
||||||
console.error(output.stderr);
|
console.error(output.stderr);
|
||||||
throw new Error('Failed to get current electron version');
|
throw new Error('Failed to get current electron version');
|
||||||
|
|
Loading…
Add table
Reference in a new issue