I published my first npm package over the weekend: github-auto-deploy.

I’ve been playing with Github Auto Deploys recently. There are a couple things I’m doing here that I think are different from the typical auto deploy workflow.

  1. Using the deployment event. Github has a way to differentiate push from deployment. Deployments have the added benefit of depending on Github statuses, like ci/travis-ci. Having deployments depend on a test suite is nice.
  2. Using git fetch && git checkout. Instead of doing a git pull and slowly updating files depending on the network speed, first fetch all the files and then do a quick file pointer swap to instantly update all files at once.

Example

PORT=1234 SECRET="Swifty4Lyfe" gad /var/app /var/app/bin/deploy.sh

In this example, deploy.sh might look something like this:

npm install
service node-app restart

If you have questions or suggestions, let me know!