Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Simple npm module to auto pull git repository on web hook call

License

Notifications You must be signed in to change notification settings

timilsinabishal/git-auto-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-auto-deploy

git-auto-deploy is the npm module for automatic deploying of node server.It launches the shell script to pull the git from origin and exit the server. Remember to use tools like forever or pm2 to respawn the server process.

NPM #Usage

Add a route for webhook in your framework.
Example for express

var gad = require('git-auto-deploy');
.............................
.............................
app.post('/webhook',function(req,res){
  var secret = "yoursecretkey";
  if(req.body.secret == secret){
    gad.deploy();
  }
}
............................

Example to setup mail address for automatic mail of deploy logs and custom repository setup

----------------------------
var mailOptions={
  from:['"Sender Name" <[email protected]>'],
  to:['"Receiver Name" <[email protected]>']
};

var mailConfig={
  service:"Gmail",
  auth:{
    user:"[email protected]",
    pass:"password"
  }
};

var repo={
  origin:"remote url",
  branch:"branch name"
};

var mail=gad.createMail(mailConfig,mailOptions);
gad.deploy(repo,mail);

For auto update after specified duration use:

setInterval(function(){
  gad.deploy()
},duration);

About

Simple npm module to auto pull git repository on web hook call

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published