Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix puppeteer@next race condition #3209

Merged
merged 2 commits into from
Sep 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion utils/apply_next_version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
const path = require('path');
const fs = require('fs');
const child_process = require('child_process');

// Compare current HEAD to upstream master SHA.
// If they are not equal - refuse to publish since
// we're not tip-of-tree.
const upstream_sha = `git ls-remote https://github.com/GoogleChrome/puppeteer --tags master | cut -f1`;
const current_sha = `git rev-parse HEAD`;
const command = `if [[ $(${upstream_sha}) == $(${current_sha}) ]]; then echo "yes"; else echo "no"; fi`;
const output = child_process.execSync(command).toString('utf8');
if (output.trim() !== 'yes') {
console.log('REFUSING TO PUBLISH: this is not tip-of-tree!');
process.exit(1);
return;
}


const package = require('../package.json');
let version = package.version;
Expand All @@ -9,4 +24,4 @@ if (dashIndex !== -1)
version += '-next.' + Date.now();
console.log('Setting version to ' + version);
package.version = version;
fs.writeFileSync(path.join(__dirname, '..', 'package.json'), JSON.stringify(package, undefined, 2) + '\n');
fs.writeFileSync(path.join(__dirname, '..', 'package.json'), JSON.stringify(package, undefined, 2) + '\n');