You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
var express = require('express');
|
|
|
|
var router = express.Router();
|
|
|
|
const { exec } = require('child_process');
|
|
|
|
//web钩子事件
|
|
|
|
//git@gogs.kirito.cool:panqihua/RiskCloudMock.git push事件
|
|
|
|
router.post('/server', function(req, res, next) {
|
|
|
|
|
|
|
|
const updated_at=req.body.repository.updated_at
|
|
|
|
|
|
|
|
// 输出当前目录(不一定是代码所在的目录)下的文件和文件夹
|
|
|
|
exec('updateRisk RiskCloudMock', (err, stdout, stderr) => {
|
|
|
|
if(err) {
|
|
|
|
console.log(err)
|
|
|
|
res.json({message:'自动部署服务端失败'})
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
res.json({message:`开始自动部署服务端,版本号:${updated_at}`})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//部署完毕事件
|
|
|
|
router.get('/server', function(req, res, next) {
|
|
|
|
res.json({message:'服务端部署成功'})
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = router;
|