From 1b45469da6237f8f4604f463f559cdee1812ad2c Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 9 Oct 2021 09:37:08 -0400 Subject: Document the git hook --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) 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. -- cgit v1.2.3