Make commit id an argument for the build publish script. (#536)

* Make commit id an argument for the build publish script.

* Make commit an optional argument for publish script.
This commit is contained in:
Cory Rivera
2018-01-22 16:02:57 -08:00
committed by GitHub
parent 006eedd3a1
commit 0c14c3cc7f

View File

@@ -14,8 +14,8 @@ import * as mime from 'mime';
import * as minimist from 'minimist';
import { DocumentClient, NewDocument } from 'documentdb';
if (process.argv.length < 6) {
console.error('Usage: node publish.js <product> <platform> <type> <name> <version> <commit> <is_update> <file>');
if (process.argv.length < 9) {
console.error('Usage: node publish.js <product_quality> <platform> <file_type> <file_name> <version> <is_update> <file> [commit_id]');
process.exit(-1);
}
@@ -263,8 +263,10 @@ function main(): void {
boolean: ['upload-only']
});
const [quality, platform, type, name, version, _isUpdate, file] = opts._;
const commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
let [quality, platform, type, name, version, _isUpdate, file, commit] = opts._;
if (!commit) {
commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
}
publish(commit, quality, platform, type, name, version, _isUpdate, file, opts).catch(err => {
console.error(err);