mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	build website in docker container
Summary: Do the website building in a docker container to avoid worrying about dependencies. Reviewed By: nikhilaravi Differential Revision: D30223892 fbshipit-source-id: 77b7b4630188167316891381f6ca9e9fbe7f0a05
This commit is contained in:
		
							parent
							
								
									d7d740abe9
								
							
						
					
					
						commit
						23ef666db1
					
				@ -7,6 +7,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# run this script from the project root using `./scripts/build_docs.sh`
 | 
					# run this script from the project root using `./scripts/build_docs.sh`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
usage() {
 | 
					usage() {
 | 
				
			||||||
  echo "Usage: $0 [-b]"
 | 
					  echo "Usage: $0 [-b]"
 | 
				
			||||||
  echo ""
 | 
					  echo ""
 | 
				
			||||||
@ -37,7 +39,7 @@ done
 | 
				
			|||||||
echo "-----------------------------------"
 | 
					echo "-----------------------------------"
 | 
				
			||||||
echo "Building PyTorch3D Docusaurus site"
 | 
					echo "Building PyTorch3D Docusaurus site"
 | 
				
			||||||
echo "-----------------------------------"
 | 
					echo "-----------------------------------"
 | 
				
			||||||
cd website || exit
 | 
					cd website
 | 
				
			||||||
yarn
 | 
					yarn
 | 
				
			||||||
cd ..
 | 
					cd ..
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -49,7 +51,7 @@ mkdir -p "website/_tutorials"
 | 
				
			|||||||
mkdir -p "website/static/files"
 | 
					mkdir -p "website/static/files"
 | 
				
			||||||
python scripts/parse_tutorials.py --repo_dir "${cwd}"
 | 
					python scripts/parse_tutorials.py --repo_dir "${cwd}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd website || exit
 | 
					cd website
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ $BUILD_STATIC == true ]]; then
 | 
					if [[ $BUILD_STATIC == true ]]; then
 | 
				
			||||||
  echo "-----------------------------------"
 | 
					  echo "-----------------------------------"
 | 
				
			||||||
 | 
				
			|||||||
@ -5,45 +5,39 @@
 | 
				
			|||||||
# This source code is licensed under the BSD-style license found in the
 | 
					# This source code is licensed under the BSD-style license found in the
 | 
				
			||||||
# LICENSE file in the root directory of this source tree.
 | 
					# LICENSE file in the root directory of this source tree.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
  echo "Usage: $0 [-b]"
 | 
					 | 
				
			||||||
  echo ""
 | 
					 | 
				
			||||||
  echo "Build and push updated PyTorch3D site."
 | 
					 | 
				
			||||||
  echo ""
 | 
					 | 
				
			||||||
  exit 1
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Current directory (needed for cleanup later)
 | 
					# Instructions, assuming you are on a fresh pytorch3d checkout on a local
 | 
				
			||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 | 
					# drive.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Make temporary directory
 | 
					# (1) Have a separate checkout of pytorch3d at the head of the gh-pages branch
 | 
				
			||||||
WORK_DIR=$(mktemp -d)
 | 
					# on a local drive. Set the variable GHP to its full path.
 | 
				
			||||||
cd "${WORK_DIR}" || exit
 | 
					# Any uncommitted changes there will be obliterated.
 | 
				
			||||||
 | 
					# For example
 | 
				
			||||||
 | 
					#   GHP=/path/to/pytorch3d-gh-pages
 | 
				
			||||||
 | 
					#   git clone -b gh-pages https://github.com/facebookresearch/pytorch3d $GHP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Clone both master & gh-pages branches
 | 
					# (2) Run this script in this directory with
 | 
				
			||||||
git clone git@github.com:facebookresearch/pytorch3d.git pytorch3d-master
 | 
					#   sudo docker run -it --rm -v $PWD/..:/loc -v $GHP:/ghp continuumio/miniconda3 bash --login /loc/scripts/publish_website.sh
 | 
				
			||||||
git clone --branch gh-pages git@github.com:facebookresearch/pytorch3d.git pytorch3d-gh-pages
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd pytorch3d-master/website || exit
 | 
					# (3) Choose a commit message, commit and push:
 | 
				
			||||||
 | 
					#   cd $GHP && git add .
 | 
				
			||||||
 | 
					#   git commit -m 'Update latest version of site'
 | 
				
			||||||
 | 
					#   git push
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build site, tagged with "latest" version; baseUrl set to /versions/latest/
 | 
					set -e
 | 
				
			||||||
yarn
 | 
					 | 
				
			||||||
yarn run build
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd .. || exit
 | 
					conda create -y -n myenv python=3.7 nodejs
 | 
				
			||||||
bash ./scripts/build_website.sh -b
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd "${WORK_DIR}" || exit
 | 
					# Note: Using bash --login together with the continuumio/miniconda3 image
 | 
				
			||||||
rm -rf pytorch3d-gh-pages/*
 | 
					# is what lets conda activate work so smoothly.
 | 
				
			||||||
touch pytorch3d-gh-pages/CNAME
 | 
					 | 
				
			||||||
echo "pytorch3d.org" > pytorch3d-gh-pages/CNAME
 | 
					 | 
				
			||||||
mv pytorch3d-master/website/build/pytorch3d/* pytorch3d-gh-pages/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd pytorch3d-gh-pages || exit
 | 
					conda activate myenv
 | 
				
			||||||
git add .
 | 
					pip install nbformat==4.4.0 nbconvert==5.3.1 ipywidgets==7.5.1 tornado==4.2 bs4 notebook==5.7.12
 | 
				
			||||||
git commit -m 'Update latest version of site'
 | 
					npm install --global yarn
 | 
				
			||||||
git push
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Clean up
 | 
					cd /loc
 | 
				
			||||||
cd "${SCRIPT_DIR}" || exit
 | 
					bash scripts/build_website.sh -b
 | 
				
			||||||
rm -rf "${WORK_DIR}"
 | 
					
 | 
				
			||||||
 | 
					rm -rf /ghp/*
 | 
				
			||||||
 | 
					echo "pytorch3d.org" > /ghp/CNAME
 | 
				
			||||||
 | 
					mv /loc/website/build/pytorch3d/* /ghp/
 | 
				
			||||||
 | 
				
			|||||||
@ -61,13 +61,9 @@ TODO: Add support for latex in markdown in jupyter notebooks and embedded images
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Build and publish the website
 | 
					## Build and publish the website
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The following script will build the tutorials and the website and push to the gh-pages
 | 
					To update for a new version, you need to build the tutorials and the website and push to the gh-pages
 | 
				
			||||||
branch of `github.com/facebookresearch/pytorch3d`.
 | 
					branch of `github.com/facebookresearch/pytorch3d`. The instructions in `scripts/publish_website.sh`
 | 
				
			||||||
 | 
					bring it all together.
 | 
				
			||||||
```
 | 
					 | 
				
			||||||
bash scripts/publish_website.sh
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Add a new tutorial
 | 
					## Add a new tutorial
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user