-
Notifications
You must be signed in to change notification settings - Fork 14
/
deploy_website.sh
executable file
·51 lines (40 loc) · 1.2 KB
/
deploy_website.sh
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
#!/bin/bash
# The website is built using MkDocs with the Material theme.
# https://squidfunk.github.io/mkdocs-material/
# It requires Python to run.
# Install the packages with the following command:
# python3 -m venv ~/mkdocs
# source ~/mkdocs/bin/activate
# pip install mkdocs mkdocs-material mdx_truly_sane_lists
if [[ "$1" = "--local" ]]; then local=true; fi
if ! [[ ${local} ]]; then
set -ex
REPO="git@github.com:uber/simple-store.git"
DIR=temp-clone
# Delete any existing temporary website clone
rm -rf ${DIR}
# Clone the current repo into temp folder
git clone --depth 1 ${REPO} ${DIR}
# Move working directory into temp folder
cd ${DIR}
# Fetch for gh-deploy
git fetch origin gh-pages:gh-pages
# Generate the API docs
./gradlew dokkaHtmlMultiModule --no-configuration-cache
fi
# Copy in special files that GitHub wants in the project root.
cp CHANGELOG.md docs/changelog.md
cp CONTRIBUTING.md docs/contributing.md
cp CODE_OF_CONDUCT.md docs/code-of-conduct.md
cp README.md docs/index.md
# Build the site and push the new files up to GitHub
if ! [[ ${local} ]]; then
mkdocs gh-deploy
else
mkdocs serve
fi
# Delete our temp folder
if ! [[ ${local} ]]; then
cd ..
rm -rf ${DIR}
fi