1.0.4 • Published 6 years ago

githook-deploy v1.0.4

Weekly downloads
1
License
-
Repository
github
Last release
6 years ago

githook-deploy

githook-deploy is an easy way for you to update your current node application, running with pm2 via simple Git Webhooks (Currently Gitlab only).

Installation

Install the dependencies and devDependencies and start the server.

$ npm install githook-deploy --save

Node Modules

githook-deploy is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.

PluginLinks
PM2GitHub
ExpressJSGitHub

Usage

Follow the snippets below and change to match your setup.

In your pm2 start script, ensure you apply the --watch argument like the example below

"start": "pm2 start Server.js --watch"

Mandatory
// Import / Require the module
GitSync = require('githook-deploy');

// Add this to your middleware. The path needs to be the same as the WebHookURL further down.
GitSync.App.use("/gitlab/webhook", GitSync.webHook())
/*
* Provide the module with the path to your git working directory.
* Can use path.resolve(__dirname) if this is in an index.js for example
* @param string
*/
GitSync.setGitDirectory()

/*
* Specify the path you would like your webhook URL to be
* @param string
*/
GitSync.setWebHookURL('/url/to/webhook')



/* 
* Listens for requests, can also provide a port parameter here
* @param int
*/
GitSync.Listen()
Optional
/*
* Set's the port for the webhook server to listen on. Default is 9977
* @param int
*/
GitSync.setPort()

/*
* Supply a secret token to verify the webhook
* @param string
*/
GitSync.setSecretToken('ThisIsASecretToken')

/*
* Logs in console when the webhook hits your application
* @param boolean
*/
GitSync.setLogging(true)

Development

Want to contribute? Great!

Simply clone the branch, do your thing and make a pull request!

Todos

  • GitHub Webhook Support

License

MIT

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago