2017-12-29 01:19:13 +00:00
|
|
|
const path = require('path');
|
|
|
|
const fs = require('fs');
|
2018-09-06 20:38:17 +00:00
|
|
|
const execSync = require('child_process').execSync;
|
2018-09-06 19:57:35 +00:00
|
|
|
|
2020-06-15 15:34:16 +00:00
|
|
|
// Compare current HEAD to upstream main SHA.
|
2018-09-06 19:57:35 +00:00
|
|
|
// If they are not equal - refuse to publish since
|
|
|
|
// we're not tip-of-tree.
|
2020-05-07 10:54:55 +00:00
|
|
|
const upstream_sha = execSync(
|
2020-06-15 15:34:16 +00:00
|
|
|
`git ls-remote https://github.com/puppeteer/puppeteer --tags main | cut -f1`
|
2020-05-07 10:54:55 +00:00
|
|
|
).toString('utf8');
|
2018-09-06 20:38:17 +00:00
|
|
|
const current_sha = execSync(`git rev-parse HEAD`).toString('utf8');
|
|
|
|
if (upstream_sha.trim() !== current_sha.trim()) {
|
2018-09-06 19:57:35 +00:00
|
|
|
console.log('REFUSING TO PUBLISH: this is not tip-of-tree!');
|
|
|
|
process.exit(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-12-29 01:19:13 +00:00
|
|
|
const package = require('../package.json');
|
|
|
|
let version = package.version;
|
|
|
|
const dashIndex = version.indexOf('-');
|
2020-05-07 10:54:55 +00:00
|
|
|
if (dashIndex !== -1) version = version.substring(0, dashIndex);
|
2017-12-29 01:19:13 +00:00
|
|
|
version += '-next.' + Date.now();
|
|
|
|
console.log('Setting version to ' + version);
|
|
|
|
package.version = version;
|
2020-05-07 10:54:55 +00:00
|
|
|
fs.writeFileSync(
|
|
|
|
path.join(__dirname, '..', 'package.json'),
|
|
|
|
JSON.stringify(package, undefined, 2) + '\n'
|
|
|
|
);
|
2020-07-10 10:51:52 +00:00
|
|
|
|
|
|
|
console.log(
|
2020-10-19 10:45:00 +00:00
|
|
|
'IMPORTANT: you should update the pinned version of devtools-protocol to match the new revision.'
|
2020-07-10 10:51:52 +00:00
|
|
|
);
|