# github-webhook-deployer

> Deploys changes using github push events.

Latest version **1.0.0** (published 2015-01-27) · BSD-3 license · 0 weekly downloads

## Install

```sh
npm install github-webhook-deployer
pnpm add github-webhook-deployer
yarn add github-webhook-deployer
bun add github-webhook-deployer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-01-27 |
| First published | 2015-01-09 |
| Weekly downloads | 0 |
| License | BSD-3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Seth Lakowske |
| Maintainers | lakowske |
| Keywords | github, webhook, deployer, push, deploy |

## Links

- npm: https://www.npmjs.com/package/github-webhook-deployer
- Repository: https://github.com/lakowske/github-webhook-deployer
- Issues: https://github.com/lakowske/github-webhook-deployer/issues
- npm.io page: https://npm.io/package/github-webhook-deployer

## Dependencies (4)

- [bl](https://npm.io/package/bl.md) ^0.9.3
- [git-rev](https://npm.io/package/git-rev.md) ^0.2.1
- [git-pull](https://npm.io/package/git-pull.md) ^0.1.0
- [github-webhook-handler](https://npm.io/package/github-webhook-handler.md) ^0.3.4

## Recent versions

- 1.0.0 (latest) — 2015-01-27
- 0.0.2 — 2015-01-10
- 0.0.1 — 2015-01-09

## README

# github-webhook-deployer 

deploys changes using github push events.

``` js
var deployer = require('github-webhook-deployer');

var server   = http.createServer(deployer({
    path : '/webhook',
    secret : 'testSecret' 
})).listen(3000);
```

# Operation

1. When a push event occurs, the current directory's branch is compared to the push event branch.
2. If they are the same, git pull; npm install and then terminate the server process.
3. The server process is restarted by foreverjs (or an equivelent daemon manager).
4. Deployment is complete and you are running the latest code.

# Example

Somewhere in the cloud there are two copies of a server, production and development.
The production branch is in ~/production and the development is in ~/development.
Both servers are started using the daemon manager foreverjs.

Now a developer wants to make some changes to the code.  The developer does a checkout of the 
development branch on their local laptop/workstation, they run the server locally and make some 
changes.  The developer can then push the changes to github.

Github webhooks broadcast the developer's change event to the production and development servers in the 
cloud.  The development server sees the update, pulls in the changes and restarts.  The 
developer can now test the changes on development server in the cloud. 

Once satisfied the development server is stable, he/she can merge the changes into the 
production branch. Another push event is triggerd and this time the production server sees the 
update, pulls in the changes and restarts.  No SSHing into the server, git pulling, and 
restarting the server.  All is well.

# Tutorial

[Deploying to your server with a git push using Github webhooks and Forever.js](http://sethlakowske.com/articles/github-push-event-deployment/)

---
_Source: https://npm.io/package/github-webhook-deployer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
