Skip to content

Commit

Permalink
[skip ci] Merging into master from: test-bot-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonolmstead33 authored Dec 15, 2016
2 parents 1316c0d + 2ab0fc2 commit 27bca92
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-bot",
"version": "0.1.0",
"version": "0.0.5",
"description": "Bot that can Build, Deploy, and Whistle",
"main": "index.js",
"scripts": {
Expand Down
18 changes: 10 additions & 8 deletions src/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ var Github = {
if (!branch){
return Promise.reject("No branch name on push");
}
var code = sh.exec('git add .');
if (code == 1){
var result = sh.exec('git add .');
if (result.code == 1){
return Promise.reject("Error on git add");
}
code = sh.exec('git commit -m "auto commit from bot: ' + message + '"');
if (code == 1){
result = sh.exec('git commit -m "auto commit from bot: ' + message + '"');
if (result.code == 1){
return Promise.reject("Error on git commit");
}
code = sh.exec('git push origin ' + branch);
if (code == 1){
result = sh.exec('git push origin ' + branch);
if (result.code == 1){
return Promise.reject("Error on git push");
}
return Promise.resolve();
Expand Down Expand Up @@ -142,5 +142,7 @@ function checkProxy(params){


//** TEST CODE ****/
Github.push('test-bot-branch', "Testing skip ci");
// Github.release("0.0.1", "[skip ci]");
//Github.preCheck('test-bot-branch');
Github.push('test-bot-branch', "Testing flow with version update");
//Github.mergeToMaster('test-bot-branch');
//Github.release("0.0.2", "[skip ci]");
30 changes: 30 additions & 0 deletions src/versioning.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var rp = require('request-promise'),
Promise = require('bluebird'),
sh = require('shelljs');

const PATCH = "patch";
const MAJOR = "major";
const MINOR = "minor";

var Versioning = {
update : function(type){
if (type != PATCH && type != MAJOR && type != MINOR) {
throw new Error("Not valid verstion update type");
}
var result = sh.exec("npm version " + type + " --force", {silent : true});
if (result.code == 1){
throw new Error("Error updating version");
}
var version = result.stdout.replace('\n', "").replace("v", "");
console.log("Updated to version: v" + version);
return version;
}
};

module.exports = Versioning;


//** TEST CODE ****/
//console.log(Versioning.update("patch"));
//console.log(Versioning.update("minor"));
//console.log(Versioning.update("major"));

0 comments on commit 27bca92

Please sign in to comment.