Skip to content

d1b1/nodejs-git-post-receive-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Basic Node.js Post-Receive Hook

This is a template script for use in a git post-recieve hook. It will checkout the code into a commit specific build folder, then run npm install and eventually npm test. This script is inspired by the heroku deployment process.

Setup & Usage

  • Setup a bare git on the remote (deployment server), git init --bare
  • Create a file called hooks/post-receive in the new remote repo.
  • Remember to the the file executable, sudo chmod +x hooks/post-receive
  • Add a remote to your local git folder git remote add myServer git@myserver.com:myrepo.git
  • Once its all set, use the new remote, git push myServer branchName

To Do

This script is evolving.

  • Add settings to define the branch for testing, deployment etc.
  • Add a check for the npm test to make certain all test pass before moving on.
  • Add the deployment and restart code. (Currently missing)
  • Add a commit/build specific URL.

References

The following links provides the code needed to string this together.

About

Simple heroku like git post-receive script.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published