summaryrefslogtreecommitdiff
path: root/provider/posts/blog
diff options
context:
space:
mode:
Diffstat (limited to 'provider/posts/blog')
-rw-r--r--provider/posts/blog/git-deploy.md51
1 files changed, 46 insertions, 5 deletions
diff --git a/provider/posts/blog/git-deploy.md b/provider/posts/blog/git-deploy.md
index 14745a6..af4d29b 100644
--- a/provider/posts/blog/git-deploy.md
+++ b/provider/posts/blog/git-deploy.md
@@ -1,17 +1,58 @@
1--- 1---
2title: dirty-haskell.org´s git-based publication system 2title: dirty-haskell.org´s git-based publication system
3published: 2016-12-08
3tags: Blog Software 4tags: Blog Software
4--- 5---
5 6
6Initially I set up dirty-haskell.org (which is currently powered by [hakyll]()) 7Initially I set up dirty-haskell.org (which is currently powered by [hakyll])
7to [rsync]() the results of compiling up onto my server whenever I intone 8to [rsync] the results of compiling up onto my server whenever I intone
8`dirty-haskell deploy`{.sh}. 9`dirty-haskell deploy`{.sh}.
9 10
10In my ever continuing quest to have my life consist mostly of an array of git 11In my ever continuing quest to have my life consist mostly of an array of git
11repositories however this didn't seem satisfactory. 12repositories however this didn't seem satisfactory.
12Therefore I configured my [gitolite]() instance to automatically compile und 13Therefore I configured my [gitolite] instance to automatically compile und
13publish the current git version whenever I push to `master`. 14publish the current git version whenever I push to `master`.
14 15
16Gitolite provides us with facilities to install [githooks]. Publishing will be
17handled by `post-update`:
18
19~~~{.sh}
20#!/usr/bin/env zsh
21
22touchedMaster=false
23
24for ref ($@); do
25 [[ ${ref} =~ .*/master$ ]] || continue
26
27 touchedMaster=true
28 break
29done
30
31$touchedMaster || exit 0
32
33exec &>(logger --id=$$ -p daemon.info -t dirty-haskell)
34
35tmpDir=$(mktemp -d)
36delTmpDir() {
37 cd /
38 rm -rvf ${tmpDir}
39}
40
41trap delTmpDir EXIT
42
43git clone --branch master --depth 1 --single-branch . ${tmpDir}
44
45cd ${tmpDir}
46nix-shell --run "dirty-haskell build"
47nix-shell --run "dirty-haskell deploy"
48~~~
49
50The script checks if the master branch was moved to a new commit or otherwise
51touched and, if so, clones a copy of the repo to a temporary directory and runs
52hakyll´s deploy command in it, which is set to rsync the compiled version to a
53folder where it´ll be picked up by nginx.
54
15[hakyll]: https://jaspervdj.be/hakyll/ 55[hakyll]: https://jaspervdj.be/hakyll/
16[rsync]: 56[rsync]: https://git.samba.org/rsync.git
17[gitolite]: 57[gitolite]: http://gitolite.com
58[githooks]: http://githooks.com