diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-12-08 20:01:13 +0100 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-12-08 20:01:13 +0100 |
commit | 5711966f8b856f9b0a4326264b84d6e839588d8c (patch) | |
tree | 0eca940a96c30d2d12ffd4ac06baba8d2dfdf386 /provider | |
parent | 64b372cf7ec8795b5061b36baf8505de02397835 (diff) | |
download | dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar.gz dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar.bz2 dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.tar.xz dirty-haskell.org-5711966f8b856f9b0a4326264b84d6e839588d8c.zip |
Finish git-deploy
Diffstat (limited to 'provider')
-rw-r--r-- | provider/posts/blog/git-deploy.md | 51 |
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 | --- |
2 | title: dirty-haskell.org´s git-based publication system | 2 | title: dirty-haskell.org´s git-based publication system |
3 | published: 2016-12-08 | ||
3 | tags: Blog Software | 4 | tags: Blog Software |
4 | --- | 5 | --- |
5 | 6 | ||
6 | Initially I set up dirty-haskell.org (which is currently powered by [hakyll]()) | 7 | Initially I set up dirty-haskell.org (which is currently powered by [hakyll]) |
7 | to [rsync]() the results of compiling up onto my server whenever I intone | 8 | to [rsync] the results of compiling up onto my server whenever I intone |
8 | `dirty-haskell deploy`{.sh}. | 9 | `dirty-haskell deploy`{.sh}. |
9 | 10 | ||
10 | In my ever continuing quest to have my life consist mostly of an array of git | 11 | In my ever continuing quest to have my life consist mostly of an array of git |
11 | repositories however this didn't seem satisfactory. | 12 | repositories however this didn't seem satisfactory. |
12 | Therefore I configured my [gitolite]() instance to automatically compile und | 13 | Therefore I configured my [gitolite] instance to automatically compile und |
13 | publish the current git version whenever I push to `master`. | 14 | publish the current git version whenever I push to `master`. |
14 | 15 | ||
16 | Gitolite provides us with facilities to install [githooks]. Publishing will be | ||
17 | handled by `post-update`: | ||
18 | |||
19 | ~~~{.sh} | ||
20 | #!/usr/bin/env zsh | ||
21 | |||
22 | touchedMaster=false | ||
23 | |||
24 | for ref ($@); do | ||
25 | [[ ${ref} =~ .*/master$ ]] || continue | ||
26 | |||
27 | touchedMaster=true | ||
28 | break | ||
29 | done | ||
30 | |||
31 | $touchedMaster || exit 0 | ||
32 | |||
33 | exec &>(logger --id=$$ -p daemon.info -t dirty-haskell) | ||
34 | |||
35 | tmpDir=$(mktemp -d) | ||
36 | delTmpDir() { | ||
37 | cd / | ||
38 | rm -rvf ${tmpDir} | ||
39 | } | ||
40 | |||
41 | trap delTmpDir EXIT | ||
42 | |||
43 | git clone --branch master --depth 1 --single-branch . ${tmpDir} | ||
44 | |||
45 | cd ${tmpDir} | ||
46 | nix-shell --run "dirty-haskell build" | ||
47 | nix-shell --run "dirty-haskell deploy" | ||
48 | ~~~ | ||
49 | |||
50 | The script checks if the master branch was moved to a new commit or otherwise | ||
51 | touched and, if so, clones a copy of the repo to a temporary directory and runs | ||
52 | hakyll´s deploy command in it, which is set to rsync the compiled version to a | ||
53 | folder 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 | ||