on 2db7ade help sign in
haskell.nix/scripts/update-docs.nix
41 lines 1.0 kB history raw
1{ stdenv, writeScript, coreutils, glibc, git, openssh, gnused, mkdocs }:
3with stdenv.lib;
5let
6 repo = "git@github.com:input-output-hk/haskell.nix.git";
7 sshKey = "/run/keys/buildkite-haskell-dot-nix-ssh-private";
8in
9 writeScript "update-docs.sh" ''
10 #!${stdenv.shell}
12 set -euo pipefail
14 export PATH="${makeBinPath [ coreutils glibc git openssh gnused mkdocs ]}"
16 source ${./git.env}
18 echo "Building..."
19 rm -rf site
20 mkdocs build
21 touch site/.nojekyll
22 sed -i -e '/Build Date/d' site/index.html
23 sed -i -e '/lastmod/d' site/sitemap.xml
24 rm -f site/sitemap.xml.gz
25 rev=$(git rev-parse --short HEAD)
27 echo "Updating git index..."
28 git fetch origin
29 git checkout gh-pages
30 git reset --hard origin/gh-pages
31 GIT_WORK_TREE=$(pwd)/site git add -A
32 check_staged
33 echo "Committing changes..."
34 git commit --no-gpg-sign --message "Update gh-pages for $rev"
36 use_ssh_key ${sshKey}
38 if [ "''${BUILDKITE_BRANCH:-}" = master ]; then
39 git push ${repo} HEAD:gh-pages
40 fi
41 ''