Build server prototype (integration with GitHub / NuGet / etc)
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.
 
 
 
 
micro-build-server/BuildServer/routes/postreceive.js

35 lines
949 B

var builder = require('../lib/builder');
/*
* POST from github
*/
module.exports = function (req, res) {
if (!req.body || (!req.body.payload && !req.body.repository)) {
return res.end();
}
if (req.header("x-github-event") !== "push") {
console.log("Got '" + req.header("x-github-event") + "' event:");
//console.log(req.body);
return res.send("Only push events are supported");
}
var payload = req.body.payload ? JSON.parse(req.body.payload) : req.body,
repository = payload.repository;
builder.build({
app: req.app,
url: repository.url,
owner: repository.owner.name,
reponame: repository.name,
rev: payload.after,
branch: payload.ref
}, function (err, result) {
console.log("Done processing request from GitHub");
console.log("Error: " + err);
//console.log("Result:");
//console.log(result);
res.send("Done processing request from GitHub\r\n" + "Error: " + err + "\r\n" + "Result: " + result);
});
};