aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2021-10-09 09:37:08 -0400
committerRob Austein <sra@hactrn.net>2021-10-09 09:37:08 -0400
commit1b45469da6237f8f4604f463f559cdee1812ad2c (patch)
tree0e7c6e61a7fbab57c5003ab9213afcb50151b93d
parentfc6e9f350c557560b335100db01ab498b29638e4 (diff)
Document the git hook
-rw-r--r--README.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/README.md b/README.md
index 9b29ee6..c353b1b 100644
--- a/README.md
+++ b/README.md
@@ -34,3 +34,38 @@ won't cause compilation to fail, so don't do that. :)
As with all Cryptech git repositories, all commits to this repository
must be signed by a known key.
+
+For completeness, here's how this hooks into git: hang something like
+the following script off the upstream repository's `update` hook:
+
+```
+#!/bin/sh -
+
+set -xe
+
+ref="$1"
+oldrev="$2"
+newrev="$3"
+
+branch=refs/heads/production
+repo=/some/where/safe.git
+work=/some/where/else
+dest=/some/where/visible
+
+if test "$ref" = "$branch"
+then
+ export CRYPTECH_WIKI_PRODUCTION_BUILD=true
+ cd $work
+ git --git-dir $repo --work-tree $work checkout --force $newrev
+ git --git-dir $repo --work-tree $work submodule update --init
+ pelican --output website --settings pelicanconf.py --fatal errors content
+ chmod -R a+rX $work
+ rsync -a --delete website/ $dest/
+fi
+```
+
+Setting `--git-dir` is *probably* unnecessary, since the hook will
+inherit the `$GIT_DIR` environment variable, but it's also harmless.
+`$CRYPTECH_WIKI_PRODUCTION_BUILD` allows our `pelicanconf.py` to
+default to developer settings while automatically using production
+settings when built using the git hook.