on patch-1 help sign in
haskell.nix/scripts/update-docs.nix
49 lines 1.3 kB history raw
1{ stdenv, lib, writeScript, coreutils, glibc, git, openssh, gnused, mkdocs
2, generatedOptions }:
4with lib;
6let
7 repo = "git@github.com:input-output-hk/haskell.nix.git";
8 sshKey = "/run/keys/buildkite-haskell-dot-nix-ssh-private";
9in
10 # update-docs depends on glibc which doesn't build on darwin
11 meta.addMetaAttrs { platforms = platforms.linux; } (writeScript "update-docs.sh" ''
12 #!${stdenv.shell}
14 set -euo pipefail
16 export PATH="${makeBinPath [ coreutils glibc git openssh gnused mkdocs ]}"
18 source ${./git.env}
20 rev=$(git rev-parse --short HEAD)
21 cd $(git rev-parse --show-toplevel)
23 echo "Preprocessing..."
24 cat ${generatedOptions} > docs/reference/modules.md
26 echo "Building..."
27 rm -rf site
28 mkdocs build
29 touch site/.nojekyll
30 sed -i -e '/Build Date/d' site/index.html
31 sed -i -e '/lastmod/d' site/sitemap.xml
32 rm -f site/sitemap.xml.gz
33 rm docs/reference/modules.md
35 echo "Updating git index..."
36 git fetch origin
37 git checkout gh-pages
38 git reset --hard origin/gh-pages
39 GIT_WORK_TREE=$(pwd)/site git add -A
40 check_staged
41 echo "Committing changes..."
42 git commit --no-gpg-sign --message "Update gh-pages for $rev"
44 use_ssh_key ${sshKey}
46 if [ "''${BUILDKITE_BRANCH:-}" = master ]; then
47 git push ${repo} HEAD:gh-pages
48 fi
49 '')