Skip to content

Commit 9f27415

Browse files
committed
updating publish script
1 parent bf408fa commit 9f27415

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

scripts/publish.js

+37-8
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,43 @@ cp(path.join(__dirname, '../AUTHORS'), cwd);
2828
cp(path.join(__dirname, '../CONTRIBUTORS'), cwd);
2929
cp(path.join(__dirname, '../COPYING'), cwd);
3030

31-
// Publish the module
32-
exec('echo "npm publish ."', {
31+
var args = process.argv.splice(1);
32+
var moduleName = args[1];
33+
var newVersion = args[2];
34+
var tagName = [moduleName, newVersion].join('-');
35+
36+
if (moduleName === 'google-cloud') {
37+
tagName = newVersion;
38+
}
39+
40+
// Create a git tag
41+
exec('git tag -a ' + tagName + ' -m "' + moduleName + ' release for ' + newVersion + '"', {
42+
cwd: cwd
43+
});
44+
45+
// Increment the version
46+
exec('npm --no-git-tag-version version ' + newVersion, {
3347
cwd: cwd
3448
});
3549

36-
// Remove the duplicated files
37-
rm([
38-
path.join(cwd, 'AUTHORS'),
39-
path.join(cwd, 'CONTRIBUTORS'),
40-
path.join(cwd, 'COPYING')
41-
]);
50+
console.log('Publishing package in 10 seconds. Exit process to abort');
51+
52+
setTimeout(function() {
53+
console.log('Publishing now');
54+
55+
// Publish the module
56+
exec('npm publish', {
57+
cwd: cwd
58+
});
59+
60+
exec('echo "Now push to master: git push origin master --follow-tags"', {
61+
cwd: cwd
62+
});
63+
64+
// Remove the duplicated files
65+
rm([
66+
path.join(cwd, 'AUTHORS'),
67+
path.join(cwd, 'CONTRIBUTORS'),
68+
path.join(cwd, 'COPYING')
69+
]);
70+
}, 10000);

0 commit comments

Comments
 (0)