change_after.js 818 字节
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3
const fs = require('fs');
module.exports = function(){
	console.log('开始执行脚本change_after');
4
/*	let changelog = fs.readFileSync(process.cwd() + '/changelog.md', 'utf-8').split("##")[1].split("\n").slice(1).join(' ');
DCloud_JSON's avatar
DCloud_JSON 已提交
5 6
	console.log(changelog);
	// 这里是修改完相关敏感配置后执行的脚本,你可以在这里自定义逻辑,
7 8 9


  // 比如执行git提交命令
DCloud_JSON's avatar
DCloud_JSON 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
	var shell = require("shelljs");
	var exec = shell.exec;
	
	if (exec('git add .').code !== 0) {
	  shell.echo('Error: Git add failed');
	  shell.exit(1);
	}
	if (exec(`git commit -a -m "${changelog}"`).code !== 0) {
	  shell.echo('Error: Git commit failed');
	  shell.exit(1);
	}
	if (exec('git push').code !== 0) {
	  shell.echo('Error: Git commit failed');
	  shell.exit(1);
	}
25 26
	shell.exec(`echo git success ${changelog}`);
  */
DCloud_JSON's avatar
DCloud_JSON 已提交
27
}