blob: 3aaa8348f3aedff0f5baa642e452031bbf825ea4 (
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
66
|
set -euxo pipefail
main() {
local langs=( en ru )
local vers=( 0.4.3 )
rm -f .cargo/config
cargo doc
local td=$(mktemp -d)
# build latest docs
cp -r target/doc $td/api
mkdir $td/book/
cp redirect.html $td/index.html
for lang in ${langs[@]}; do
( cd book/$lang && mdbook build )
cp -r book/$lang/book $td/book/$lang
cp LICENSE-* $td/book/$lang/
done
# build older docs
for ver in ${vers[@]}; do
local prefix=${ver%.*}
mkdir -p $td/$prefix/book
local src=$(mktemp -d)
curl -L https://github.com/rtfm-rs/cortex-m-rtfm/archive/v${ver}.tar.gz | tar xz --strip-components 1 -C $src
pushd $src
cargo doc || cargo doc --features timer-queue
cp -r target/doc $td/$prefix/api
for lang in ${langs[@]}; do
( cd book/$lang && mdbook build )
cp -r book/$lang/book $td/$prefix/book/$lang
cp LICENSE-* $td/$prefix/book/$lang/
done
popd
rm -rf $src
done
mkdir ghp-import
curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz |
tar --strip-components 1 -C ghp-import -xz
./ghp-import/ghp_import.py $td
set +x
git push -fq https://$GH_TOKEN@github.com/rtfm-rs/cortex-m-rtfm.git gh-pages && echo OK
rm -rf $td
}
# fake Travis variables to be able to run this on a local machine
if [ -z ${TRAVIS_BRANCH-} ]; then
TRAVIS_BRANCH=master
fi
if [ -z ${TRAVIS_PULL_REQUEST-} ]; then
TRAVIS_PULL_REQUEST=false
fi
if [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ]; then
main
fi
|