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