publish_website.sh 1.24 KB
Newer Older
Nikhila Ravi's avatar
Nikhila Ravi committed
1
#!/bin/bash
Patrick Labatut's avatar
Patrick Labatut committed
2
3
4
5
6
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
7
8
9
10
11
12
13
14
15

usage() {
  echo "Usage: $0 [-b]"
  echo ""
  echo "Build and push updated PyTorch3D site."
  echo ""
  exit 1
}

Nikhila Ravi's avatar
Nikhila Ravi committed
16
# Current directory (needed for cleanup later)
17
18
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Nikhila Ravi's avatar
Nikhila Ravi committed
19
# Make temporary directory
20
21
22
WORK_DIR=$(mktemp -d)
cd "${WORK_DIR}" || exit

Nikhila Ravi's avatar
Nikhila Ravi committed
23
# Clone both master & gh-pages branches
24
25
26
27
28
git clone git@github.com:facebookresearch/pytorch3d.git pytorch3d-master
git clone --branch gh-pages git@github.com:facebookresearch/pytorch3d.git pytorch3d-gh-pages

cd pytorch3d-master/website || exit

Nikhila Ravi's avatar
Nikhila Ravi committed
29
# Build site, tagged with "latest" version; baseUrl set to /versions/latest/
30
yarn
Nikhila Ravi's avatar
Nikhila Ravi committed
31
yarn run build
32
33

cd .. || exit
34
bash ./scripts/build_website.sh -b
35
36
37
38
39
40
41
42
43
44
45
46

cd "${WORK_DIR}" || exit
rm -rf pytorch3d-gh-pages/*
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
git add .
git commit -m 'Update latest version of site'
git push

Nikhila Ravi's avatar
Nikhila Ravi committed
47
# Clean up
48
cd "${SCRIPT_DIR}" || exit
Nikhila Ravi's avatar
Nikhila Ravi committed
49
rm -rf "${WORK_DIR}"