Sophia revised this gist 1 week ago · 8413b77

1 file changed, 25 insertions

build-repo-site.sh (file created)
@@ -0,0 +1,25 @@
1 + #!/bin/sh
2 +
3 + REPO=$1
4 +
5 + cd ~/repos/$REPO.git
6 +
7 + REVS=`git show-branch | perl -nle 'm/^\[([^\]]*)\]/; print $1'`
8 +
9 + TAGS=`git tag --sort=-taggerdate | head -n 5 | head -c -1 | tr '\n' ','`
10 + if [ -n "$TAGS" ]; then
11 + REVS=$REVS,$TAGS
12 + fi
13 +
14 + if [ -n "$2" ]; then
15 + REVS=$REVS,$2
16 + fi
17 +
18 + echo $REVS
19 +
20 + pgit \
21 + -repo . \
22 + -clone-url https://serve.example.com/$REPO.git \
23 + -root-relative /$REPO/ \
24 + -revs $REVS \
25 + -out /var/lib/wwwroot/$REPO