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
ssh into your server (has your public ssh key)
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
Repeat for staging server, if you want.
I'm using Make:
Deploy to production
make prod
Deploy to staging
make staging