The elusive post-receive example that I so often need
you can't run forever
1 file changed, +15 -0
+15-0post-receive
| @@ -0,0 +1,15 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | + | |
| 3 | +# define the project details | |
| 4 | +project=vflcountdown | |
| 5 | +base='/web/$project' | |
| 6 | + | |
| 7 | +while read oldrev newrev refname | |
| 8 | +do | |
| 9 | + branch=`echo "$refname" | sed 's:.*/::'` | |
| 10 | + worktree='$base/$project-$branch' | |
| 11 | + git --work-tree=$worktree --git-dir=$base.git checkout -f $branch | |
| 12 | + cd $worktree | |
| 13 | + # project commands | |
| 14 | + npm run build | |
| 15 | +done |