更改 commit text

master
xiejianxiong 4 years ago
parent 78e9feecaf
commit 108e232afa

@ -13,9 +13,9 @@ program.parse(process.argv);
const env = program.args[0];
const codeBranchArg = program.args[1];
const buildBranchArg = program.args[2];
console.log('codeBranchArg: ', codeBranchArg);
console.log('buildBranchArg: ', buildBranchArg);
console.log('env: ', env);
const mapping = {
'test': { cmd: 'test-build', codeBranch: 'dev', buildBranch: 'dev_aliyun' },
@ -23,17 +23,18 @@ const mapping = {
'pro': { cmd: 'build', codeBranch: 'dev', buildBranch: 'develop' },
}
const cmd = mapping[env].cmd;
const codeBranch = codeBranchArg || mapping[env].codeBranch;
const buildBranch = buildBranchArg || mapping[env].buildBranch;
console.log('codeBranch: ', codeBranch);
console.log('buildBranch: ', buildBranch);
if (!mapping[env]) {
console.log(chalk.red(`not exist ${env} branch`));
return;
}
const cmd = mapping[env].cmd;
const codeBranch = codeBranchArg || mapping[env].codeBranch;
const buildBranch = buildBranchArg || mapping[env].buildBranch;
const runBuild = (task) => new Promise(async resolve => {
try {
shell.cd(codePath);
@ -42,7 +43,7 @@ const runBuild = (task) => new Promise(async resolve => {
await execa('npm', ['run', cmd]);
resolve();
} catch (e) {
console.log('run build error: ', e);
task.skip('Failed run build');
resolve();
}
@ -58,11 +59,12 @@ const deleteBuild = (task) => new Promise(async resolve => {
shell.rm('-rf', `${buildPath}/static`);
await execa('git', ['add', '.']);
await execa('git', ['commit', '-m', `'自动发布'`]);
const text = `xjx auto publish ${new Date().toLocaleString()}`;
await execa('git', ['commit', '-m', `'${text}'`]);
await execa('git', ['push', 'origin', buildBranch]);
resolve();
} catch (e) {
console.log('delete build error: ', e);
task.skip('Failed delete build');
resolve();
}
@ -74,11 +76,12 @@ const copyBuild = (task) => new Promise(async resolve => {
shell.cd(buildPath);
await execa('git', ['add', '.']);
await execa('git', ['commit', '-m', `'自动发布'`]);
const text = `xjx auto publish ${new Date().toLocaleString()}`;
await execa('git', ['commit', '-m', `'${text}'`]);
await execa('git', ['push', 'origin', buildBranch]);
resolve();
} catch (e) {
console.log('copyBuild error: ', e);
task.skip('Failed copy build');
resolve();
}
@ -100,5 +103,5 @@ const tasks = new Listr([
]);
tasks.run().catch(err => {
console.log(err)
});

@ -1,6 +1,6 @@
{
"name": "zq_auto_publish",
"version": "1.0.5",
"version": "1.0.6",
"description": "",
"main": "index.js",
"bin": {

Loading…
Cancel
Save