"vscode:/vscode.git/clone" did not exist on "1255bc9b45686e50795f2bd7a3f312cac2536bca"
publish_website.sh 1.1 KB
Newer Older
Nikhila Ravi's avatar
Nikhila Ravi committed
1
#!/bin/bash
Jeremy Reizenstein's avatar
Jeremy Reizenstein committed
2
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
3
4
5
6
7
8
9
10
11

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

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

Nikhila Ravi's avatar
Nikhila Ravi committed
15
# Make temporary directory
16
17
18
WORK_DIR=$(mktemp -d)
cd "${WORK_DIR}" || exit

Nikhila Ravi's avatar
Nikhila Ravi committed
19
# Clone both master & gh-pages branches
20
21
22
23
24
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
25
# Build site, tagged with "latest" version; baseUrl set to /versions/latest/
26
yarn
Nikhila Ravi's avatar
Nikhila Ravi committed
27
yarn run build
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

cd .. || exit
./scripts/build_website.sh -b

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
43
# Clean up
44
cd "${SCRIPT_DIR}" || exit
Nikhila Ravi's avatar
Nikhila Ravi committed
45
rm -rf "${WORK_DIR}"