summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/quickbook/build/publish-docs
blob: ab134474dc3f56c1f8453fc74dd25f547b6fe0bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#==============================================================================
#   Copyright (c) 2017 Daniel James
#
#   Use, modification and distribution is subject to the Boost Software
#   License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
#   http://www.boost.org/LICENSE_1_0.txt)
#==============================================================================

#!/usr/bin/env bash
set -e

# Change to the quickbook root directory
cd $(dirname $0)
cd ..

# Git settings
remote=git@github.com:boostorg/quickbook.git
branch=gh-pages

main() {
    git fetch "$remote" "$branch:$branch"
    b2 -aq doc//fully-standalone
    write_fast_import gh-pages | git fast-import --date-format=now --quiet
    git push "$remote" "$branch"
}

write_fast_import() {
    committer="$(git config user.name) <$(git config user.email)>"
    commit_message="Rebuild documentation"
    branch=$1

    # Start commit
    echo "commit refs/heads/${branch}"
    echo "committer ${committer} now"
    echo "data ${#commit_message}"
    echo $commit_message
    echo "from ${branch}"
    echo "merge HEAD"

    # Delete everything and rebuild tree from scratch.
    echo "deleteall"

    # Copy all files from HEAD
    git ls-tree -r HEAD |
    while read mode type hash path ; do
        echo "M $mode $hash $path"
    done

    # Preserve index.html from the github pages branch
    git ls-tree $branch -- index.html |
    while read mode type hash path ; do
        echo "M $mode $hash $path"
    done

    # Check in documentation
    find doc/html -type f | while read path; do
        size=$(wc -c "$path")
        echo "M 100644 inline $path"
        echo "data $size"
        cat "$path"
        echo
    done
}

main