Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Add script to build doc files for all versions (#7636)
Browse files Browse the repository at this point in the history
* Add script to build doc files for all versions

* Fix

* Use add versipn script of each different version
  • Loading branch information
kevinthesun authored and piiswrong committed Aug 28, 2017
1 parent e051297 commit aceef5a
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions docs/build_version_doc/build_all_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# This script is for locally building website for all versions
# Built files are stored in $built
# Version numbers are stored in $tag_list.
# Version numbers are ordered from latest to old and final one is master.
tag_list="0.11.0.rc3 master"

mxnet_url="https://github.com/apache/incubator-mxnet.git"
mxnet_folder="apache_mxnet"
built="VersionedWeb"
mkdir $built
mkdir "$built/versions"

git clone $mxnet_url $mxnet_folder --recursive
cd "$mxnet_folder/docs"
tag_file="tag_list.txt"

# Write all version numbers into $tag_file
for tag in $tag_list; do
if [ $tag != 'master' ]
then
echo "$tag" >> "$tag_file"
fi
done

# Build all versions and use latest version(First version number in $tag_list) as landing page.
version_num=0
for tag in $tag_list; do
if [ $tag == 'master' ]
then
git checkout master
else
git checkout "tags/$tag"
fi

git submodule update || exit 1
cd ..
make clean
cd docs
make clean
make html USE_OPENMP=0 || exit 1
python build_version_doc/AddVersion.py --file_path "_build/html/" --current_version "$tag" || exit 1

if [ $tag != 'master' ]
then
python build_version_doc/AddPackageLink.py --file_path "_build/html/get_started/install.html" \
--current_version "$tag" || exit 1
fi

if [ $version_num == 0 ]
then
cp -a _build/html/. "../../$built"
else
file_loc="../../$built/versions/$tag"
mkdir "$file_loc"
cp -a _build/html/. "$file_loc"
fi

((++version_num))
done

mv "$tag_file" "../../$built/tag.txt"
cd ../..
rm -rf "$mxnet_folder"

0 comments on commit aceef5a

Please sign in to comment.