I wanted something simple for staging and deploying my static site.
- Generate build locally
- Push the build to a bare git repo on your server
- A
post-receivehook checks out the files in the public directory
Repeat for staging server, if you want.
# ssh into your server
$ ssh you@example.org
# create a directory for your site
$ mkdir ~/example.com
# create a directory for git
$ mkdir ~/example.git
# create a bare git repo
$ cd example.git
$ git init --bare
# setup a post-receive hook
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/path/to/example.com git checkout -f
$ chmod +x hooks/post-receive
I'm using Make:
make prod
make staging