diff options
author | Rob Austein <sra@hactrn.net> | 2021-10-09 09:37:08 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2021-10-09 09:37:08 -0400 |
commit | 1b45469da6237f8f4604f463f559cdee1812ad2c (patch) | |
tree | 0e7c6e61a7fbab57c5003ab9213afcb50151b93d | |
parent | fc6e9f350c557560b335100db01ab498b29638e4 (diff) |
Document the git hook
-rw-r--r-- | README.md | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -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. |